Skip to content

Add base-ref-aware stale lock guard for workflow markdown edits#44912

Merged
pelikhan merged 7 commits into
mainfrom
copilot/hippo-add-stale-lock-guard
Jul 11, 2026
Merged

Add base-ref-aware stale lock guard for workflow markdown edits#44912
pelikhan merged 7 commits into
mainfrom
copilot/hippo-add-stale-lock-guard

Conversation

Copilot AI commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Stale .lock.yml files after .github/workflows/*.md edits were still slipping through and causing avoidable CI churn. This change adds a fast stale-lock guard that works both for local edits and clean CI checkouts, with explicit remediation to run make recompile.

  • Guard behavior: detect stale lock files in both local and CI contexts

    • Extended scripts/check-stale-lock-files.sh with --base-ref <git-ref>.
    • Detection now supports:
      • local working-tree/staged changes (git diff HEAD), and
      • clean checkout comparisons (git diff <base-ref>...HEAD).
    • Kept failure output focused on affected workflow markdown files and remediation.
  • Contributor/CI path wiring

    • Updated Makefile check-stale-lock-files target to resolve base ref from:
      • CHECK_STALE_LOCK_BASE_REF, or
      • origin/$GITHUB_BASE_REF / $GITHUB_BASE_REF when available.
    • Added check-stale-lock-files as a prerequisite of make lint so stale locks fail earlier.
  • Coverage for stale vs clean base-ref scenarios

    • Expanded scripts/check-stale-lock-files_test.sh with base-ref cases:
      • markdown changed without lock update (fails),
      • markdown and lock changed together (passes).

Example usage in CI-style comparison:

bash scripts/check-stale-lock-files.sh --base-ref origin/main
# ...
# ERROR: ... workflow .md files were modified but their .lock.yml was not regenerated
# Fix:
#   make recompile

Copilot AI and others added 5 commits July 11, 2026 08:03
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review July 11, 2026 08:17
Copilot AI review requested due to automatic review settings July 11, 2026 08:17
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add stale-lock guard for workflow markdown edits Add base-ref-aware stale lock guard for workflow markdown edits Jul 11, 2026
Copilot AI requested a review from pelikhan July 11, 2026 08:19

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

Adds base-reference support to detect stale workflow lock files in clean CI checkouts.

Changes:

  • Adds --base-ref diffing.
  • Adds committed-change tests.
  • Integrates the guard into make lint.
Show a summary per file
File Description
scripts/check-stale-lock-files.sh Adds base-ref change detection.
scripts/check-stale-lock-files_test.sh Tests committed markdown and lock changes.
Makefile Configures base-ref selection and lint integration.

Review details

Tip

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

Comments suppressed due to low confidence (1)

Makefile:957

  • This does not wire the guard into pull-request CI because no PR workflow invokes the aggregate make lint target. The CGO workflow calls individual targets instead (.github/workflows/cgo.yml:1181-1215), and CJS similarly calls lint-cjs/format targets (.github/workflows/cjs.yml:154-161); the only workflow calling make lint is the manually dispatched format workflow. Add an explicit guard step to a PR workflow (with full base history) so the stated CI enforcement actually runs.
	@bash scripts/check-action-sh-no-python.sh
  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment on lines +79 to +84
if git rev-parse --verify "${BASE_REF}^{commit}" >/dev/null 2>&1; then
git diff --name-only "${BASE_REF}...HEAD" 2>/dev/null || true
return
fi
echo -e "${YELLOW}WARN${NC}: --base-ref not found (${BASE_REF}); falling back to working-tree check." >&2
fi
Comment on lines +107 to 108
[ -f "$md" ] || continue
lock="${md%.md}.lock.yml"
Comment thread Makefile Outdated
Comment on lines +787 to +793
elif [ -n "$${GITHUB_BASE_REF:-}" ] && git rev-parse --verify "origin/$${GITHUB_BASE_REF}^{commit}" >/dev/null 2>&1; then \
bash scripts/check-stale-lock-files.sh --base-ref "origin/$${GITHUB_BASE_REF}"; \
elif [ -n "$${GITHUB_BASE_REF:-}" ] && git rev-parse --verify "$${GITHUB_BASE_REF}^{commit}" >/dev/null 2>&1; then \
bash scripts/check-stale-lock-files.sh --base-ref "$${GITHUB_BASE_REF}"; \
else \
bash scripts/check-stale-lock-files.sh; \
fi
@pelikhan pelikhan merged commit f7f7352 into main Jul 11, 2026
42 checks passed
@pelikhan pelikhan deleted the copilot/hippo-add-stale-lock-guard branch July 11, 2026 08:33
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.8

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.

[hippo] Add stale-lock guard for workflow markdown edits

3 participants