Repository navigation
Added opt-in GitHub release scanning #4
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
6 commits
Select commit
Hold shift + click to select a range
4c70783
Added opt-in GitHub release scanning
chriopter 184f79d
Update .github/workflows/scan-releases.yml
chriopter ef008f5
Update .github/workflows/scan-releases.yml
chriopter 2181271
Run release scanner daily instead of hourly
chriopter 8b03a23
Update scan-releases.py
chriopter 210ec11
Use named arguments for release scanner function calls
chriopter 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
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,82 @@ | ||
| name: Scan releases | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '37 3 * * *' | ||
| workflow_dispatch: | ||
| pull_request: | ||
| paths: | ||
| - 'scan-releases.py' | ||
| - 'tests/**' | ||
| - 'homebrew_database/**' | ||
| - '.github/workflows/scan-releases.yml' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: release-scanner-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| tests: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.12' | ||
| - run: python -m unittest discover -s tests -v | ||
|
|
||
| scan: | ||
| needs: tests | ||
| if: github.repository == 'pspdev/homebrew' && github.ref_name == 'main' && github.event_name != 'pull_request' | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 45 | ||
| permissions: | ||
| contents: write | ||
| actions: write | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| ref: main | ||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.12' | ||
| - name: Scan approved entries | ||
| id: scan | ||
| continue-on-error: true | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| run: python scan-releases.py | ||
| - name: Check for changes | ||
| id: changes | ||
| run: | | ||
| git add -- data resources/icons | ||
| if ! git diff --cached --quiet; then | ||
| echo 'changed=true' >> "$GITHUB_OUTPUT" | ||
| fi | ||
| - name: Validate with the existing website build | ||
| if: steps.changes.outputs.changed == 'true' | ||
| run: | | ||
| python -m pip install -r requirements.txt | ||
| python build.py | ||
| - name: Commit and push validated updates | ||
| if: steps.changes.outputs.changed == 'true' | ||
| run: | | ||
| git config user.name 'github-actions[bot]' | ||
| git config user.email '41898282+github-actions[bot]@users.noreply.github.com' | ||
| git commit -m 'Added releases from approved repositories' | ||
| # A concurrent change to main rejects this push. Never force or | ||
| # rebase generated data over a curator's edits; the next run retries. | ||
| git push origin HEAD:main | ||
| - name: Publish updated database | ||
| if: steps.changes.outputs.changed == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: gh workflow run publish.yml --ref main | ||
| - name: Report scan failures | ||
| if: always() && steps.scan.outcome == 'failure' | ||
| run: | | ||
| echo 'Some entries could not be scanned; see the scan log. Their existing data was kept.' | ||
| exit 1 | ||
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
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.
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.