Skip to content

Emit workflow pins as a downloadable patch artifact#127

Merged
jeffhandley merged 2 commits into
mainfrom
jeffhandley/release-workflow
Jun 13, 2026
Merged

Emit workflow pins as a downloadable patch artifact#127
jeffhandley merged 2 commits into
mainfrom
jeffhandley/release-workflow

Conversation

@jeffhandley

Copy link
Copy Markdown
Member

GITHUB_TOKEN cannot push commits that modify files under .github/workflows/, so the release workflow can no longer pin the labeler workflow files to the release commit on its own. Re-pin them as a patch instead:

  • Commit and push the predict/action.yml image digest update to the release branch as before.
  • Apply the dotnet/issue-labeler/* pin updates to the working tree, capture them with git diff into $RUNNER_TEMP/workflow-pins.patch, and reset the working tree to keep the post-checkout cleanup clean.
  • Upload workflow-pins.patch as a run artifact and reproduce the diff in the step summary inside a ```diff fence so the patch can be applied via a follow-up pull request.
  • Permit the leading "- " in "- uses: ..." so the regex matches the inline step form (e.g. labeler-cache-retention.yml).
  • Replace the \1 backreference with ${1} so a SHA beginning with a digit is not parsed as an extended octal escape.
  • Drop the unused packages: read permission from this job; it only reads digest strings from upstream job outputs and never queries the packages API.

GITHUB_TOKEN cannot push commits that modify files under
.github/workflows/, so the release workflow can no longer pin the
labeler workflow files to the release commit on its own. Re-pin them
as a patch instead:

* Commit and push the predict/action.yml image digest update to the
  release branch as before.
* Apply the dotnet/issue-labeler/* pin updates to the working tree,
  capture them with git diff into $RUNNER_TEMP/workflow-pins.patch,
  and reset the working tree to keep the post-checkout cleanup clean.
* Upload workflow-pins.patch as a run artifact and reproduce the diff
  in the step summary inside a ```diff fence so the patch can be
  applied via a follow-up pull request.
* Permit the leading "- " in "- uses: ..." so the regex matches the
  inline step form (e.g. labeler-cache-retention.yml).
* Replace the \1 backreference with ${1} so a SHA beginning with a
  digit is not parsed as an extended octal escape.
* Drop the unused packages: read permission from this job; it only
  reads digest strings from upstream job outputs and never queries the
  packages API.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 13, 2026 07:59
@github-actions github-actions Bot added the area-Workflows Related to the issue-labeler reusable workflows label Jun 13, 2026
@jeffhandley jeffhandley added area-Release Related to release staging, promotion, and versioning and removed area-Workflows Related to the issue-labeler reusable workflows labels Jun 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the release workflow to work around GITHUB_TOKEN restrictions on modifying .github/workflows/* by generating workflow pin updates as a downloadable patch artifact instead of committing them directly on the release branch.

Changes:

  • Commit and push only the predict/action.yml image digest update during release.
  • Re-pin dotnet/issue-labeler/* workflow uses: SHAs in the working tree, capture the changes into workflow-pins.patch, then reset the working tree.
  • Upload workflow-pins.patch as a run artifact and include the patch content in the workflow step summary.

Comment thread .github/workflows/release.yml
Under `set -e`, `git commit` with nothing staged exits non-zero and
would abort the job when the release workflow is re-run against an
already-pinned digest. Gate the commit and push on `git diff --cached
--quiet` so a re-run is idempotent. RELEASE_SHA is still taken from
`git rev-parse HEAD`, which correctly points at the original release
commit in the skip path.

Addresses PR #127 review feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@jeffhandley jeffhandley merged commit 3783d9b into main Jun 13, 2026
3 checks passed
@jeffhandley jeffhandley deleted the jeffhandley/release-workflow branch June 13, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Release Related to release staging, promotion, and versioning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants