Skip to content

Conversation

@FidelusAleksander
Copy link
Contributor

Changes

This pull request streamlines the GitHub Actions workflow for starting an exercise by merging the previously separate "Update README" job into the "Create exercise issue" job. It also adds logic to update image URLs in step files and ensures that both the README.md and any step markdown files are committed together. These changes simplify the workflow and improve consistency in handling exercise resources.

Workflow consolidation and simplification:

  • Merged the update_readme job into the create_exercise job, so that updating the README and creating the exercise issue now happen in a single job, reducing redundancy and improving maintainability. [1] [2]

Step file and README updates:

  • Added a step to find and replace image URLs in .github/steps/*.md files, ensuring that image references point to the correct repository and branch when exercises are started from a template.
  • Updated the commit step to include both README.md and all step markdown files in .github/steps/*.md, so all relevant documentation changes are committed together.

Output and variable fixes:

  • Fixed the reference for the issue_url template variable to use the correct output from the current job steps instead of a removed job dependency.

Checklist

  • I have added or updated appropriate labels to this PR
  • I have tested my changes
  • I have updated the documentation if needed

Copilot AI review requested due to automatic review settings February 2, 2026 11:41
@github-actions github-actions bot added the workflows Changes to reusable workflows label Feb 2, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request consolidates the GitHub Actions workflow for starting exercises by merging the update_readme job into the create_exercise job, and adds functionality to replace absolute image URLs in step files to point to the current repository instead of the template repository.

Changes:

  • Consolidated update_readme job into create_exercise job to reduce workflow complexity
  • Added find-and-replace step to update raw.githubusercontent.com URLs in .github/steps/*.md files
  • Updated commit step to include both README.md and step markdown files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +98 to +99
find: 'raw\.githubusercontent\.com/${{ steps.get-template-repo.outputs.TEMPLATE_REPOSITORY }}/([a-f0-9]{40}|refs/heads/[^/]+)/'
replace: 'raw.githubusercontent.com/${{ github.repository }}/${{ github.ref }}/'
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex pattern for finding URLs includes refs/heads/[^/]+, but raw.githubusercontent.com URLs do not use the refs/heads/ prefix in their paths. They use the format raw.githubusercontent.com/owner/repo/branch-name/path or raw.githubusercontent.com/owner/repo/commit-sha/path.

Additionally, the replacement uses github.ref which returns the full reference format (e.g., refs/heads/main), but raw.githubusercontent.com URLs expect just the branch name (e.g., main).

This will create invalid URLs like raw.githubusercontent.com/owner/repo/refs/heads/main/image.png instead of the correct raw.githubusercontent.com/owner/repo/main/image.png.

Consider using github.ref_name instead of github.ref in the replace pattern, and update the find pattern to match actual raw.githubusercontent.com URL formats. The find pattern should be something like: raw\.githubusercontent\.com/${{ steps.get-template-repo.outputs.TEMPLATE_REPOSITORY }}/[a-f0-9]{40}/ for commit SHAs or handle branch names without the refs/heads/ prefix.

Suggested change
find: 'raw\.githubusercontent\.com/${{ steps.get-template-repo.outputs.TEMPLATE_REPOSITORY }}/([a-f0-9]{40}|refs/heads/[^/]+)/'
replace: 'raw.githubusercontent.com/${{ github.repository }}/${{ github.ref }}/'
find: 'raw\.githubusercontent\.com/${{ steps.get-template-repo.outputs.TEMPLATE_REPOSITORY }}/([a-f0-9]{40}|[^/]+)/'
replace: 'raw.githubusercontent.com/${{ github.repository }}/${{ github.ref_name }}/'

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch but not ideal

Would need to figure out a way to use github.ref_name when raw.githubusercontent is used with a branch name and github.ref when used with a permalink

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we just restrict ourselves to always use raw.githubusercontent pointing to a branch name instead of a commit but that is not ideal with PR's

ref: ${{ env.EXERCISE_TOOLKIT_REF }}


- name: Build welcome message from template
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step has the same name as another step at line 103. While both build messages from templates, they serve different purposes (one for the issue description, one for the README). Consider using distinct names like "Build README from template" to improve clarity and make debugging easier.

Suggested change
- name: Build welcome message from template
- name: Build README from template

Copilot uses AI. Check for mistakes.
replace: 'raw.githubusercontent.com/${{ github.repository }}/${{ github.ref }}/'
include: '.github/steps/*.md'
regex: true

Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line contains trailing whitespace. Consider removing it to maintain consistent code formatting.

Suggested change

Copilot uses AI. Check for mistakes.
path: exercise-toolkit
ref: ${{ env.EXERCISE_TOOLKIT_REF }}


Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line contains trailing whitespace. Consider removing it to maintain consistent code formatting.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

workflows Changes to reusable workflows

Development

Successfully merging this pull request may close these issues.

2 participants