Bump Runner Versions #2
This file contains hidden or 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
| name: Bump Runner Versions | |
| on: | |
| schedule: | |
| - cron: "0 12 * * 4" | |
| workflow_dispatch: | |
| jobs: | |
| bump: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| # Github prevents workflow triggers on pushes made by GITHUB_TOKEN. | |
| # You will have to issue a separate PAT with `contents: write` permissions. | |
| token: ${{ secrets.PAT }} | |
| - name: Fetch latest versions | |
| id: latest | |
| run: | | |
| RUNNER=$(gh release view --repo actions/runner --json tagName -q '.tagName | ltrimstr("v")') | |
| echo "Latest runner version: $RUNNER" | |
| HOOKS=$(gh release view --repo actions/runner-container-hooks --json tagName -q '.tagName | ltrimstr("v")') | |
| echo "Latest hooks version: $HOOKS" | |
| cat > versions.env <<EOF | |
| RUNNER_VERSION=$RUNNER | |
| RUNNER_CONTAINER_HOOKS_VERSION=$HOOKS | |
| EOF | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Commit and push | |
| run: | | |
| git diff --quiet versions.env && { | |
| echo "Runner versions are already up-to-date." | |
| exit 0 | |
| } | |
| echo "Runner versions are outdated will be bumped." | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add versions.env | |
| git commit -m "chore: bump runner versions" | |
| git push |