update-runner-version #6
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
--- | |
name: update-runner-version | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get runner version | |
run: | | |
echo RUNNER_LATEST=$(curl -s "https://api.github.com/repos/actions/runner/releases/latest" | jq '.tag_name[1:]' --raw-output) >> $GITHUB_ENV | |
- name: Bump runner version | |
run: | | |
find . -type f -name "Dockerfile" -exec sed -i '' 's/ARG RUNNER_VERSION="[^"]*"/ARG RUNNER_VERSION="${{ env.RUNNER_LATEST }}"/g' {} \; | |
- name: Create Pull Request | |
id: pr | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
commit-message: 'chore: Bump Github actions self-hosted runner version' | |
title: 'feat: Bump Github actions self-hosted runner version' | |
body: | | |
New version of Github actions self-hosted was [released](https://github.com/actions/runner/releases/tag/v${{ env.RUNNER_LATEST }}) | |
base: main | |
branch: feat/update-runner-version | |
delete-branch: true | |
- name: Setup GH CLI | |
if: ${{ steps.pr.outputs.pull-request-number }} | |
uses: sersoft-gmbh/setup-gh-cli-action@v2 | |
with: | |
version: stable | |
- name: Enable Pull Request Automerge | |
if: ${{ steps.pr.outputs.pull-request-number }} | |
run: gh pr merge --squash --auto "${{ steps.pr.outputs.pull-request-number }}" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |