Skip to content

Update Buildscript

Update Buildscript #57

# Checks daily to see if the buildscript is in need of an update
name: Update Buildscript
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 Repository
uses: actions/checkout@v4
- name: Setup Build
uses: ./.github/actions/build_setup
- name: Run Buildscript Updater
run: ./gradlew updateBuildScript --warning-mode all --build-cache
- name: Get New Buildscript 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@v5
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
if: steps.create-pull-request.outputs.pull-request-operation == 'created'
run: gh pr merge --squash --auto "${{ steps.create-pull-request.outputs.pull-request-number }}"
env:
GH_TOKEN: ${{ secrets.BUILDSCRIPT_UPDATER_TOKEN }}