-
Notifications
You must be signed in to change notification settings - Fork 1.7k
chore: Adds version scanner CI/CD upgrades #17425
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
+428
−127
Merged
Changes from 8 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
0952729
feat: complete Phase 1 of version_scanner project
chalmerlowe 163b773
test: fix ConfigManager signature and regex assertions
chalmerlowe 3fd95aa
test: fix regex rule compilation in tests
chalmerlowe 632e3da
fix: prevent truncation in sys.version_info.minor regexes
chalmerlowe 6b844c6
fix: force string format in CSV output to prevent spreadsheet truncation
chalmerlowe f679fd7
build: update version_scanner.yml triggers to match repo standards
chalmerlowe 2356936
chore: test workflow on push
chalmerlowe 7b8f3c3
chore: update workflow trigger for new branch
chalmerlowe dc6b011
build: fix scanner output redirection and add artifact upload
chalmerlowe f357200
chore: updates github action versions and scanner config
chalmerlowe ae291ad
chore: update filename
chalmerlowe 8b64db7
feat(scanner): add --soft-fail CLI flag and integrate in GHA workflow
chalmerlowe 265ba67
chore(scanner): expand branch triggers to match any version-scanner b…
chalmerlowe e1c6391
chore(scanner): update cron trigger to run hourly
chalmerlowe 4f67a1a
chore(scanner): simplify console output by removing rule listing and …
chalmerlowe fe5c56a
chore(scanner): update soft-fail help text and test docstring
chalmerlowe cc8cd2d
refactor(tests): use idiomatic pytest.raises instead of try-except fo…
chalmerlowe a002eb1
chore(scanner): address PR review comments on limit, safe-int, and st…
chalmerlowe e6fe5f6
docs(scanner): add descriptive docstrings to spreadsheet helpers
chalmerlowe ed30dab
Apply suggestion from @chalmerlowe
chalmerlowe 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
Some comments aren't visible on the classic Files Changed page.
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,69 @@ | ||
| name: Version Scanner | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - feat/version-scanner-cicd-upgrades | ||
| schedule: | ||
| - cron: '0 7 * * 2' # Run weekly on Tuesdays at 7 AM UTC (mirrors main.yml) | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| issues: write | ||
|
|
||
| jobs: | ||
| scan: | ||
| name: Run Version Scanner | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.14' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install pyyaml | ||
|
|
||
| - name: Run Version Scanner | ||
| run: | | ||
| # We pipe the output to a file so we can read it in the next step | ||
| python scripts/version_scanner/version_scanner.py -d python -v 3.7 --stdout > scanner_output.csv | ||
|
|
||
| - name: Create or update issue on finding | ||
| if: failure() | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| TITLE="Version Scanner found deprecated dependencies" | ||
| RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
|
|
||
| # Read the first 50 lines to prevent blowing up the issue body if it's massive | ||
| CSV_PREVIEW=$(head -n 50 scanner_output.csv) | ||
|
|
||
| BODY="The [Version Scanner]($RUN_URL) found deprecated dependencies in the repository. | ||
|
|
||
| **Matches Found:** | ||
| \`\`\`csv | ||
| $CSV_PREVIEW | ||
| \`\`\` | ||
| *(If there are more than 50 matches, see the workflow logs for the full list)*" | ||
|
|
||
| # Mirroring regenerate-all.yml: check if an issue already exists to prevent spam | ||
| EXISTING_ISSUE=$(gh issue list --state open --search "in:title \"$TITLE\"" --json number --jq '.[0].number') | ||
|
|
||
| if [ -z "$EXISTING_ISSUE" ]; then | ||
| echo "WOULD HAVE CREATED ISSUE:" | ||
| echo "gh issue create --title \"$TITLE\" --body \"$BODY\"" | ||
| # gh issue create --title "$TITLE" --body "$BODY" | ||
| else | ||
| echo "Issue #$EXISTING_ISSUE already exists." | ||
| echo "WOULD HAVE ADDED COMMENT:" | ||
| echo "gh issue comment \"$EXISTING_ISSUE\" --body \"Another scanner run found deprecated dependencies: $RUN_URL\"" | ||
| # gh issue comment "$EXISTING_ISSUE" --body "Another scanner run found deprecated dependencies: $RUN_URL" | ||
| fi | ||
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
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
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.
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.
The following is a prototype of enabling the creation of an issue if/when future regressions are found, since the scans are intended to be run nightly OR as a post-submit (exact cadence is TBD during a later phase of the project).