Skip to content

Commit 6c16143

Browse files
authored
Improve GitHub Actions specs (#15965)
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
1 parent 1714028 commit 6c16143

File tree

5 files changed

+23
-0
lines changed

5 files changed

+23
-0
lines changed

.github/workflows/build_wheels.yml

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches: [main, master, 'release*']
66
tags: ['*']
77

8+
permissions:
9+
contents: write
10+
811
jobs:
912
build-wheels:
1013
if: github.repository == 'python/mypy'

.github/workflows/docs.yml

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ on:
1414
- CREDITS
1515
- LICENSE
1616

17+
permissions:
18+
contents: read
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
22+
cancel-in-progress: true
23+
1724
jobs:
1825
docs:
1926
runs-on: ubuntu-latest

.github/workflows/mypy_primer.yml

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ on:
1515
- 'mypy/test/**'
1616
- 'test-data/**'
1717

18+
permissions:
19+
contents: read
20+
1821
concurrency:
1922
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
2023
cancel-in-progress: true

.github/workflows/test.yml

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ on:
1515
- CREDITS
1616
- LICENSE
1717

18+
permissions:
19+
contents: read
20+
1821
concurrency:
1922
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
2023
cancel-in-progress: true

.github/workflows/test_stubgenc.yml

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ on:
1212
- 'mypy/stubdoc.py'
1313
- 'test-data/stubgen/**'
1414

15+
permissions:
16+
contents: read
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
20+
cancel-in-progress: true
21+
1522
jobs:
1623
stubgenc:
1724
# Check stub file generation for a small pybind11 project

0 commit comments

Comments
 (0)