-
Notifications
You must be signed in to change notification settings - Fork 26
chore(ci): harden workflows, pin actions, add zizmor + dependabot #363
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
Open
banesullivan
wants to merge
3
commits into
pyOpenSci:main
Choose a base branch
from
banesullivan:chore/ci-hardening
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
| @@ -1,21 +1,26 @@ | ||
| version: 2 | ||
|
|
||
| updates: | ||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| - package-ecosystem: github-actions | ||
| directory: / | ||
| schedule: | ||
| interval: monthly | ||
| interval: weekly | ||
| cooldown: | ||
| default-days: 7 | ||
| labels: | ||
| - security | ||
| - dependency-update | ||
| commit-message: | ||
| prefix: "chore: bump GitHub Actions" | ||
| include: "scope" | ||
| open-pull-requests-limit: 5 | ||
| rebase-strategy: auto | ||
| groups: | ||
| actions: | ||
| patterns: | ||
| - "*" | ||
| patterns: ["*"] | ||
| commit-message: | ||
| prefix: "ci" | ||
|
|
||
| - package-ecosystem: pip | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| directory: / | ||
| schedule: | ||
| interval: weekly | ||
| cooldown: | ||
| default-days: 7 | ||
| groups: | ||
| python: | ||
| patterns: ["*"] | ||
| commit-message: | ||
| prefix: "deps" | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,39 @@ | ||
| name: Run update-contributors script | ||
|
|
||
| on: | ||
| workflow_call: | ||
| secrets: | ||
| gh_token: | ||
| description: 'The GitHub token used to run the update-contributors script' | ||
| required: true | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| run_update_contributors: | ||
| name: Update contributors | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read # read repo for checkout | ||
| steps: | ||
| # TODO: consider replacing python/pip/update-web-metadata installs with docker image | ||
| - name: Setup Python | ||
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | ||
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | ||
|
|
||
| - name: Upgrade pip | ||
| run: | | ||
| # install pip=>20.1 to use "pip cache dir" | ||
| python -m pip install --upgrade pip wheel | ||
|
|
||
| - name: Install package | ||
| run: python -m pip install git+https://github.com/pyopenSci/update-web-metadata | ||
|
|
||
| - name: Check out the code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Run script from update-web-metadata repo | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: update-contributors |
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 |
|---|---|---|
| @@ -1,9 +1,16 @@ | ||
| name: Test run-script workflow | ||
|
|
||
| on: push | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| test_run_script_job: | ||
| name: Test run-script | ||
| uses: ./.github/workflows/run-script.yml | ||
| secrets: | ||
| gh_token: ${{ secrets.GITHUB_TOKEN }} |
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,38 @@ | ||
| name: zizmor | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - .github/workflows/** | ||
| - .github/actions/** | ||
| - action.yml | ||
| - action.yaml | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - .github/workflows/** | ||
| - .github/actions/** | ||
| - action.yml | ||
| - action.yaml | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: zizmor-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
|
|
||
| jobs: | ||
| zizmor: | ||
| name: Static analysis of Actions workflows | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read # check out the repo | ||
| security-events: write # upload SARIF to code scanning | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Run zizmor | ||
| uses: zizmorcore/zizmor-action@0dce2577a4760a2749d8cfb7a84b7d5585ebcb7d # v0.5.0 |
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 |
|---|---|---|
| @@ -1,6 +1,23 @@ | ||
| # zizmor allow-list for pyosMeta | ||
| # Every entry must have a justification comment. | ||
|
|
||
| rules: | ||
| secrets-outside-env: | ||
| ignore: | ||
| - add-help-wanted.yml:23:29 | ||
| - run-tests.yml:44:22 | ||
| - test-update-contribs.yml:43:22 | ||
| # GHPROJECT_HELP_WANTED is an org-level token required for cross-repo | ||
| # project board writes; it cannot be scoped to a deployment environment | ||
| # without blocking the label-triggered event. Track migration in: | ||
| # https://github.com/pyOpenSci/pyosMeta/issues/TBD | ||
| - add-help-wanted.yml | ||
| # GITHUB_TOKEN in run-tests.yml and test-update-contribs.yml are used | ||
| # for read-only API calls against the pyOpenSci website data. No | ||
| # additional scope is granted beyond the default token permissions. | ||
| - run-tests.yml | ||
| - test-update-contribs.yml | ||
|
|
||
| superfluous-actions: | ||
| ignore: | ||
| # peter-evans/create-pull-request is the standard action for | ||
| # opening PRs from scheduled jobs; gh pr create cannot authenticate | ||
| # with the custom PYOS_PR_TOKEN needed to trigger downstream checks. | ||
| - test-update-contribs.yml |
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
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.