Update Buildscript #216
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
# 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/GregTech' | |
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 |