-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy over the buildscript updater (#62)
- Loading branch information
1 parent
dfeabe8
commit 413fbdb
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Checks daily to see if the buildscript is in need of an update | ||
name: Buildscript Updating | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 0 * * *" # "min hr day month year", so run once per day | ||
|
||
jobs: | ||
buildscript-update: | ||
runs-on: ubuntu-latest | ||
# Avoid running this workflow on forks | ||
if: github.repository == 'GregTechCEu/gregicality-multiblocks' | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '17' | ||
|
||
- name: Run script updater | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: 'updateBuildScript' | ||
generate-job-summary: false | ||
gradle-home-cache-includes: | | ||
caches | ||
jdks | ||
notifications | ||
wrapper | ||
- name: Get new script version | ||
id: version-check | ||
run: | | ||
new_version=$(head -1 build.gradle | sed -r 's|//version: (.*)|\1|g') | ||
echo "NEW_VERSION=$new_version" >> "$GITHUB_OUTPUT" | ||
- name: Create Pull Request | ||
id: create-pull-request | ||
uses: peter-evans/create-pull-request@v4 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.BUILDSCRIPT_UPDATER_TOKEN }} | ||
with: | ||
token: ${{ secrets.BUILDSCRIPT_UPDATER_TOKEN }} | ||
committer: GitHub <[email protected]> | ||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | ||
commit-message: 'update build script version to ${{ steps.version-check.outputs.NEW_VERSION }}' | ||
branch: gha-update-buildscript | ||
title: Update build script version to ${{ steps.version-check.outputs.NEW_VERSION }} | ||
body: This pull request is created by the buildscript-update workflow | ||
labels: ignore changelog | ||
|
||
- name: Enable pull request auto-merge | ||
id: pull-request-auto-merge | ||
if: steps.create-pull-request.outputs.pull-request-operation == 'created' | ||
uses: peter-evans/enable-pull-request-automerge@v3 | ||
with: | ||
token: ${{ secrets.BUILDSCRIPT_UPDATER_TOKEN }} | ||
pull-request-number: ${{ steps.create-pull-request.outputs.pull-request-number }} | ||
merge-method: squash |