Repository navigation
test(all): CI check to make sure description mentions every changed file #120
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
742fdc5
CI testing v1
iswheeler 5ba37cc
Fix name
iswheeler 96b5387
Fix 2
iswheeler 97a5fce
Fix invalid YAML
iswheeler 9fca266
Work on PR description check
iswheeler 4ad4c40
Skipped empty lines
iswheeler 705cbd3
Test 3
iswheeler 26e336d
Tweaked error message
iswheeler b125f8b
Removed dead lines
iswheeler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # .github/workflows/check-target.yaml | ||
| name: Description mentions every changed file | ||
| on: | ||
| pull_request: | ||
| types: [opened, edited, synchronize, reopened, labeled, unlabeled] | ||
| jobs: | ||
| check-description: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Pull request description mentions every changed file | ||
| env: | ||
| PR_BODY: ${{ github.event.pull_request.body }} | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| gh pr diff ${{ github.event.pull_request.number }} \ | ||
| --repo ${{ github.repository }} --name-only > tmp_changed_files.txt | ||
| python3 .github/workflows/pr_description_check.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import os | ||
|
|
||
| BLACK = "\033[0;30m"; | ||
| RED = "\033[0;31m"; | ||
| GREEN = "\033[0;32m"; | ||
| YELLOW = "\033[0;33m"; | ||
| BLUE = "\033[0;34m"; | ||
| MAGENTA = "\033[0;35m"; | ||
| CYAN = "\033[0;36m"; | ||
| WHITE = "\033[0;37m"; | ||
| RESET = "\033[0m"; | ||
|
|
||
| pr_body = os.environ["PR_BODY"] | ||
|
|
||
| all_accounted_for = True | ||
|
|
||
| with open("tmp_changed_files.txt") as f: | ||
| lines = f.read().split("\n") | ||
| for line in lines: | ||
| if line.strip() == "": | ||
| continue # Skip empty lines | ||
| parts = line.split("/") | ||
| filename = parts[len(parts) - 1] | ||
| if filename in pr_body: | ||
| print(GREEN+"✓ Changed file "+filename+" in PR description"+RESET) | ||
| else: | ||
| all_accounted_for = False | ||
| print(RED+"✗ Changed file "+filename+" not found in PR description"+RESET) | ||
|
|
||
|
|
||
| if all_accounted_for: | ||
| exit(0) | ||
| else: | ||
| print("::error::Please edit your pull request description to make sure it lists all changed files. See above for details") | ||
| exit(1) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.