Skip to content

Commit

Permalink
Improve GitHub Actions specs (#15965)
Browse files Browse the repository at this point in the history
Two main changes:
1. Always use secure permissions, when some workflow does not do
anything, it has to be `contents: read` only
2. Be more consistent with canceling workflows
  • Loading branch information
sobolevn authored Aug 29, 2023
1 parent 1714028 commit 6c16143
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches: [main, master, 'release*']
tags: ['*']

permissions:
contents: write

jobs:
build-wheels:
if: github.repository == 'python/mypy'
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ on:
- CREDITS
- LICENSE

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
docs:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/mypy_primer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
- 'mypy/test/**'
- 'test-data/**'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
- CREDITS
- LICENSE

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/test_stubgenc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ on:
- 'mypy/stubdoc.py'
- 'test-data/stubgen/**'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
stubgenc:
# Check stub file generation for a small pybind11 project
Expand Down

0 comments on commit 6c16143

Please sign in to comment.