Skip to content

Sync GHA Runner

Sync GHA Runner #127

Workflow file for this run

---
name: Sync GHA Runner
on:
workflow_dispatch:
schedule:
- cron: '0 5 * * *'
jobs:
release:
runs-on: thevickypedia-default
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Get Latest Runner Version
run: |
export LATEST_RUNNER_VERSION=$(curl -sL \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/actions/runner/releases/latest | jq .tag_name --raw-output)
echo "LATEST_RUNNER_VERSION=$LATEST_RUNNER_VERSION" >> $GITHUB_ENV
shell: bash
- name: Judgement Day
run: |
FOUND=$(curl -sL \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/releases \
| jq --arg v "${{ env.LATEST_RUNNER_VERSION }}" \
'[.[].tag_name] | index($v) != null')
if [ "$FOUND" != "true" ]; then
echo "::notice title=${{ env.LATEST_RUNNER_VERSION }}::A new version of GitHub Actions Runner is available."
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
notes="- [${{ env.LATEST_RUNNER_VERSION }}](https://github.com/actions/runner/releases/tag/${{ env.LATEST_RUNNER_VERSION }})"
echo "$notes" > release_notes.txt
cat release_notes.txt
echo "release=true" >> $GITHUB_ENV
else
echo "::notice title=UpToDate::GitHub Actions Runner is up to date."
echo "release=false" >> $GITHUB_ENV
fi
shell: bash
- name: Create Release
if: env.release == 'true'
run: |
gh release create "${{ env.LATEST_RUNNER_VERSION }}" \
--title "${{ env.LATEST_RUNNER_VERSION }}" \
--notes-file release_notes.txt
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
shell: bash