diff --git a/.github/workflows/_update-self-references.yml b/.github/workflows/_update-self-references.yml new file mode 100644 index 0000000..91f090d --- /dev/null +++ b/.github/workflows/_update-self-references.yml @@ -0,0 +1,57 @@ +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@v4 + 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: + 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 + reviewers: | + FidelusAleksander + labels: | + skip-release-notes + maintenance diff --git a/.github/workflows/finish-exercise.yml b/.github/workflows/finish-exercise.yml index 18cf0c7..693467e 100644 --- a/.github/workflows/finish-exercise.yml +++ b/.github/workflows/finish-exercise.yml @@ -17,6 +17,9 @@ permissions: contents: write issues: write +env: + EXERCISE_TOOLKIT_REF: v0.5.0 + jobs: update_readme: name: Update README with congratulations @@ -34,7 +37,7 @@ jobs: with: repository: skills/exercise-toolkit path: exercise-toolkit - ref: v0.5.0 + ref: ${{ env.EXERCISE_TOOLKIT_REF }} - name: Build congratulations message from template id: build-new-readme @@ -67,7 +70,7 @@ jobs: with: repository: skills/exercise-toolkit path: exercise-toolkit - ref: v0.5.0 + ref: ${{ env.EXERCISE_TOOLKIT_REF }} - name: Build message - exercise finished id: build-finish-message diff --git a/.github/workflows/start-exercise.yml b/.github/workflows/start-exercise.yml index f0aa1d0..2f20003 100644 --- a/.github/workflows/start-exercise.yml +++ b/.github/workflows/start-exercise.yml @@ -29,6 +29,9 @@ permissions: actions: write # Disable workflows issues: write # Create issue +env: + EXERCISE_TOOLKIT_REF: v0.5.0 + jobs: disable_workflows: name: Disable exercise workflows @@ -64,7 +67,7 @@ jobs: with: repository: skills/exercise-toolkit path: exercise-toolkit - ref: v0.5.0 + ref: ${{ env.EXERCISE_TOOLKIT_REF }} - name: Build welcome message from template id: build-issue-description @@ -107,7 +110,7 @@ jobs: with: repository: skills/exercise-toolkit path: exercise-toolkit - ref: v0.5.0 + ref: ${{ env.EXERCISE_TOOLKIT_REF }} - name: Build welcome message from template id: build-new-readme