Skip to content

Commit

Permalink
ci: consolidate permissions in workflows (#88)
Browse files Browse the repository at this point in the history
Fixes #86
  • Loading branch information
afuetterer committed May 28, 2024
1 parent d259f0e commit a09d461
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 25 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Ref: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/customizing-code-scanning
name: CodeQL

permissions:
contents: read

on:
push:
branches: [main]
pull_request:
workflow_dispatch:
workflow_dispatch: # run manually from actions tab

# Set permissions at the job level.
permissions: {}

jobs:
analyze:
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ on:
release:
types: [created]
workflow_call:
# run manually from actions tab
workflow_dispatch:
workflow_dispatch: # run manually from actions tab

# Set permissions at the job level.
permissions: {}

env:
PYTHONUNBUFFERED: 1

permissions:
contents: read

jobs:
docs:
# Disables this workflow from running in a repository that is not part of the indicated organization/user
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ on:
paths:
- .github/labels.yml
- .github/workflows/label.yml
workflow_dispatch:
workflow_dispatch: # run manually from actions tab

permissions:
contents: read
# Set permissions at the job level.
permissions: {}

jobs:
label:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ concurrency:
group: ci-${{ github.head_ref }}
cancel-in-progress: true

# Set permissions at the job level.
permissions: {}

env:
PYTHONUNBUFFERED: 1
FORCE_COLOR: 1

permissions:
contents: read

jobs:
test:
uses: ./.github/workflows/test.yml
Expand All @@ -23,6 +23,8 @@ jobs:
# disables this workflow from running in a repository that is not part of the indicated organization/user
if: github.repository_owner == 'afuetterer'
runs-on: ubuntu-24.04
permissions:
contents: read
needs:
- test
steps:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ concurrency:
group: pr-${{ github.head_ref }}
cancel-in-progress: true

# Set permissions at the job level.
permissions: {}

env:
PYTHONUNBUFFERED: 1
FORCE_COLOR: 1

permissions:
contents: read

jobs:
test:
uses: ./.github/workflows/test.yml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
- cron: 0 0 * * 0
workflow_dispatch: # run manually from actions tab

permissions:
contents: read
# Set permissions at the job level.
permissions: {}

jobs:
stale:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name: Test
on:
workflow_call:

# Set permissions at the job level.
permissions: {}

env:
PYTHONUNBUFFERED: 1
FORCE_COLOR: 1

permissions:
contents: read

jobs:
test:
name: Python ${{ matrix.python-version }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/upgrade-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ on:
- cron: 0 0 1 * *
workflow_dispatch: # run manually from actions tab

permissions:
contents: read
# Set permissions at the job level.
permissions: {}

jobs:
upgrade:
Expand Down

0 comments on commit a09d461

Please sign in to comment.