-
Notifications
You must be signed in to change notification settings - Fork 475
Add PR-level stale lock file guard for workflow markdown edits #47238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
86cb3ad
634b700
5610f9f
46fb717
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: Stale Lock Files | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
| paths: | ||
| - '.github/workflows/*.md' | ||
| - 'scripts/check-stale-lock-files.sh' | ||
| - '.github/workflows/stale-lock-files.yml' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| check-stale-lock-files: | ||
| name: Check for stale .lock.yml files | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| concurrency: | ||
| group: ci-${{ github.ref }}-stale-lock-files | ||
| cancel-in-progress: true | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Fetch base branch | ||
| if: github.event_name == 'pull_request' | ||
| run: git fetch origin ${{ github.base_ref }} --no-tags | ||
|
|
||
| - name: Check stale lock files | ||
| run: | | ||
| bash scripts/check-stale-lock-files.sh --base-ref "origin/${{ github.base_ref }}" | ||
|
|
||
| - name: Add step summary on failure | ||
| if: failure() | ||
| run: | | ||
| echo "## ❌ Stale Lock Files Detected" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "One or more \`.github/workflows/*.md\` files were modified but their" >> $GITHUB_STEP_SUMMARY | ||
| echo "compiled \`.lock.yml\` outputs were not regenerated." >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "**To fix**, recompile the workflows and commit the updated lock files:" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY | ||
| echo "make recompile" >> $GITHUB_STEP_SUMMARY | ||
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "Then commit the regenerated \`.lock.yml\` files together with the \`.md\` changes." >> $GITHUB_STEP_SUMMARY | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -473,9 +473,17 @@ bundle-js: | |
| @echo "✓ bundle-js tool built" | ||
| @echo "To bundle a JavaScript file: ./bundle-js <input-file> [output-file]" | ||
|
|
||
| # Test all code (Go, JavaScript, and wasm golden) | ||
| # Run Bash script tests (check-stale-lock-files, check-workflow-drift) | ||
| .PHONY: test-scripts | ||
| test-scripts: build | ||
| @echo "Running Bash script tests..." | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Fix by adding the build prerequisite: test-scripts: build@copilot please address this. |
||
| bash scripts/check-stale-lock-files_test.sh | ||
| bash scripts/check-workflow-drift_test.sh ./$(BINARY_NAME) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/tdd] 💡 Suggested fixAdd .PHONY: test-scripts
test-scripts: build
\techo "Running Bash script tests..."
\tbash scripts/check-stale-lock-files_test.sh
\tbash scripts/check-workflow-drift_test.sh ./$(BINARY_NAME)
\t@echo "✓ All Bash script tests passed"
@copilot please address this. |
||
| @echo "✓ All Bash script tests passed" | ||
|
|
||
| # Test all code (Go, JavaScript, wasm golden, and shell scripts) | ||
| .PHONY: test-all | ||
| test-all: test test-js test-wasm-golden | ||
| test-all: test test-js test-wasm-golden test-scripts | ||
|
|
||
| # Run tests with coverage | ||
| .PHONY: test-coverage | ||
|
|
@@ -1238,7 +1246,8 @@ help: | |
| @echo " test-impacted-js - Run impacted JavaScript unit tests for current branch changes" | ||
| @echo " test-impacted-go - Run impacted Go unit tests for current branch changes" | ||
| @echo " test-impacted - Run impacted JavaScript and Go unit tests for current branch changes" | ||
| @echo " test-all - Run all tests (Go, JavaScript, and wasm golden)" | ||
| @echo " test-scripts - Run Bash script tests (check-stale-lock-files, check-workflow-drift)" | ||
| @echo " test-all - Run all tests (Go, JavaScript, wasm golden, and shell scripts)" | ||
| @echo " test-wasm-golden - Run wasm golden tests (Go string API path)" | ||
| @echo " test-wasm - Build wasm and run Node.js golden comparison test" | ||
| @echo " update-wasm-golden - Regenerate wasm golden files from current compiler output" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[/diagnosing-bugs]
workflow_dispatchdoes not populategithub.base_ref, so the script receives--base-ref "origin/"(empty ref). The fallback on a clean checkout finds no working-tree changes and silently exits 0 — the guard is a no-op for manual runs.💡 Suggested fix
Guard the base-ref flag on whether the event is a pull request:
Or simply remove
workflow_dispatchfrom the triggers if a meaningful manual run is not needed.@copilot please address this.