Skip to content

feat: include bug report url at the beginning of each exercise (#96) #18

feat: include bug report url at the beginning of each exercise (#96)

feat: include bug report url at the beginning of each exercise (#96) #18

# This workflow uses a Personal Access Token instead of built-in GITHUB_TOKEN to create the pull request
# This is necessary because it commits changes to workflow files, which is not allowed with the default GITHUB_TOKEN.
# See example https://github.com/peter-evans/create-pull-request/issues/3558
# The PAT needs to have `contents: write` `pull-requests: write` and `workflows: write` permissions.
name: Update Self-References
on:
push:
branches:
- main
paths:
# Currently reusable workflows only use markdown-templates but this may be extended to actions and other files in the future
- "markdown-templates/**"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
update_versions:
name: Update Exercise Toolkit Version References
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Update EXERCISE_TOOLKIT_REF in workflow files
uses: jacobtomlinson/gha-find-replace@v3
with:
find: 'EXERCISE_TOOLKIT_REF: [^\s]+'
replace: "EXERCISE_TOOLKIT_REF: ${{ github.sha }}"
include: ".github/workflows/*.yml"
exclude: ".github/workflows/_*.yml"
regex: true
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.EXERCISE_TOOLKIT_TOKEN }}
commit-message: "chore: update exercise-toolkit self-references to latest commit"
title: "chore: update exercise-toolkit self-references to latest commit"
body: |
## 🔄 Automated Version Update
This PR automatically updates the `EXERCISE_TOOLKIT_REF` environment variable in reusable workflows to reference the latest commit
---
*This PR was automatically created by the `update-self-references` workflow.*
branch: update-self-refs
delete-branch: true
add-paths: |
.github/workflows/*.yml
draft: false
labels: |
skip-release-notes