Add Github workflow for updating Github Actions. #3
Workflow file for this run
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 GitHub Actions | |
on: | |
schedule: | |
- cron: 0 3 * * 0 | |
push: | |
jobs: | |
update_github_actions: | |
name: Update GitHub Actions | |
runs-on: ubuntu-latest | |
steps: | |
- name: Look up Git repository in cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: .git/ | |
key: update-github-actions-cache-git-${{ github.run_id }} | |
restore-keys: | | |
update-github-actions-cache-git | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: bugfix | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: .version-python | |
- name: Setup git | |
uses: fregante/setup-git-user@v2 | |
- name: Generate token | |
uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.TOKEN_APP_ID }} | |
private-key: ${{ secrets.TOKEN_APP_SECRET }} | |
- name: Update GitHub Actions | |
run: | | |
GITHUB_TOKEN=${{ steps.app-token.outputs.token }} ./build update_github_actions | |
git add .github/workflows/*.y*ml | |
- name: Check for uncommitted changes | |
id: check-for-changes | |
run: git diff-index --cached --quiet HEAD || echo "has-changes=true" >> $GITHUB_OUTPUT | |
- name: Commit changes | |
if: ${{ steps.check-for-changes.outputs.has-changes == 'true' }} | |
run: git commit -m "[Bot] Update GitHub Actions." | |
- name: Save Git repository to cache | |
uses: actions/cache/save@v4 | |
if: success() || failure() | |
with: | |
path: .git/ | |
key: update-github-actions-cache-git-${{ github.run_id }} |