Skip to content

ci: freeze PR links on merge - #111

Merged
michen00 merged 2 commits into
mainfrom
ci/freeze-pr-links
Oct 20, 2026
Merged

michen00 merged 2 commits into
mainfrom
ci/freeze-pr-links

Conversation

@michen00

Copy link
Copy Markdown
Owner

Summary

A pull request body or comment that links a file on its own head branch, https://github.com/michen00/custom-commit-hooks/blob/<branch>/<path>, stops resolving once the branch is deleted on merge. Of the last 60 merged pull requests here, 17 have such a link in the body.

.github/workflows/freeze-pr-links.yml calls the published michen00/freeze-pr-links action at v0.1.0 when a pull request merges into main. The action rewrites each head-branch link in the body, the conversation comments, the review comments and the review summaries to point at the head commit's SHA. GitHub keeps that commit reachable through refs/pull/<n>/head after the branch is gone. A workflow_dispatch with pr_number freezes a pull request that merged before the workflow existed, which is how the 17 can be repaired after this merges.

The workflow grants contents: read and pull-requests: write, checks out nothing, and runs nothing from the pull request; the action's SECURITY.md states its own properties. The v0.1.0 tag is covered by a ruleset in that repository that blocks updating or deleting it, and the existing Dependabot github-actions entry will propose later releases. .github/instructions/CI.instructions.md gains an entry for the workflow.

Testing

make check passes: the pre-commit hooks, including actionlint and yamllint, every shell suite and 102 Python tests.

A pull_request_target workflow is read from main, so this pull request cannot run it; its own merge is the first run.

🤖 Generated with Claude Code

A pull request body or comment that links its own head branch breaks
once the branch is deleted on merge. The new workflow calls the
published michen00/freeze-pr-links action, which pins each such link
to the head commit's SHA when the pull request merges. A dispatch
with a pull request number freezes one that merged earlier.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michen00
michen00 requested a balanced review from Copilot October 20, 2026 07:14
@codecov-commenter

codecov-commenter commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.79%. Comparing base (0333d91) to head (5255fdf).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #111   +/-   ##
=======================================
  Coverage   57.79%   57.79%           
=======================================
  Files          33       33           
  Lines        2872     2872           
=======================================
  Hits         1660     1660           
  Misses       1212     1212           
Flag Coverage Δ
integration 0.74% <ø> (ø)
unit 57.36% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

🔵 Needs a closer look

It introduces a security-sensitive pull_request_target trigger with pull-requests: write permissions invoking a third-party action, which warrants final human sign-off despite following the no-checkout safe pattern.

No open issues 🎉

What changed in this PR

This PR adds a new GitHub Actions workflow, freeze-pr-links.yml, that rewrites a merged pull request's links pointing at its own head branch (.../blob/<branch>/<path>) into head-commit SHA permalinks, so they keep resolving after the branch is deleted on merge. It delegates the work to the published third-party action michen00/freeze-pr-links@v0.1.0 and documents the workflow in the CI instructions. It fits the repo's existing suite of PR-lifecycle automation workflows.

Changes:

  • Add pull_request_target (closed, base main) + workflow_dispatch workflow that runs the pinned freeze-pr-links action with minimal contents: read / pull-requests: write permissions and a no-checkout, safe pattern.
  • Support manual backfill via a pr_number dispatch input to repair PRs merged before the workflow existed.
  • Document the new workflow in .github/instructions/CI.instructions.md.
File Description
.github/​workflows/​freeze-pr-links.yml New workflow invoking michen00/freeze-pr-links@v0.1.0 on merge/dispatch with scoped permissions and concurrency gating.
.github/​instructions/​CI.instructions.md Adds a documentation entry describing the new workflow's purpose and triggers.

Review effort: Balanced

Repository owner deleted a comment from qodo-code-review Bot Oct 20, 2026
@michen00
michen00 merged commit 394dc49 into main Oct 20, 2026
16 checks passed
@michen00
michen00 deleted the ci/freeze-pr-links branch October 20, 2026 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants