Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'update actions runner' workflow #105

Merged
merged 2 commits into from
Sep 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions .github/workflows/update-actions-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Get latest GitHub Actions Runner

on:
schedule:
- cron: '40 18 * * *'
- cron: "40 18 * * *"
jobs:
update-runner:
runs-on: ubuntu-latest
Expand All @@ -11,11 +11,13 @@ jobs:
uses: actions/checkout@v3
with:
token: ${{ secrets.ROBOT_MAC_FC_TOKEN }}

- name: Set release version and current version variables
id: get-versions
run: |
echo ::set-output name=current_tag::$(grep ACTIONS_VERSION Dockerfile | cut -d'=' -f 2 | sed -e 's/^"//' -e 's/"$//')
echo ::set-output name=release_tag::$(curl -sL https://api.github.com/repos/actions/runner/releases/latest | jq -r ".tag_name[1:] | tostring")

- name: Change release version in Dockerfile
if: ${{ steps.get-versions.outputs.release_tag != steps.get-versions.outputs.current_tag }}
id: update-version
Expand All @@ -24,26 +26,18 @@ jobs:
NEW_VERSION: ${{ steps.get-versions.outputs.release_tag }}
run: |
sed -i --expression='s,"'"$OLD_VERSION"'","'"$NEW_VERSION"'",g' Dockerfile
- name: set up Git
if: ${{ steps.get-versions.outputs.release_tag != steps.get-versions.outputs.current_tag }}
env:
GITHUB_TOKEN: ${{ secrets.ROBOT_MAC_FC_TOKEN }}
GITHUB_ACTOR_NAME: "@robot-mac-fc"
GITHUB_ACTOR_EMAIL: "[email protected]"
run: |
git config --global user.name "${GITHUB_ACTOR_NAME}"
git config --global user.email "${GITHUB_ACTOR_EMAIL}"

- name: Create Pull Request
if: ${{ steps.get-versions.outputs.release_tag != steps.get-versions.outputs.current_tag }}
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.ROBOT_MAC_FC_TOKEN }}
commit-message: Update actions runner to new version
author: ${GITHUB_ACTOR_NAME} <${GITHUB_ACTOR_EMAIL}>
author: robot-mac-fc <[email protected]>
branch: update-actions-runner-to-${{ steps.get-versions.outputs.release_tag }}
delete-branch: true
title: Update Actions Runner Version to ${{ steps.get-versions.outputs.release_tag }}
body: |
Automated update from Github Actions Runner version ${{ steps.get-versions.outputs.current_tag }} to version ${{ steps.get-versions.outputs.release_tag }}
Release Notes: https://github.com/actions/runner/releases/tag/v${{ steps.get-versions.outputs.release_tag }}
team-reviewers: MAC-FC
team-reviewers: MAC-FC