Skip to content

Commit

Permalink
Merge pull request #127 from TimWolla/github-action-permissions
Browse files Browse the repository at this point in the history
Configure fine-grained GitHub Action permissions
  • Loading branch information
asgrim authored Nov 25, 2024
2 parents 2b50a13 + c67c2b2 commit 17ca9d5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
pull_request:
push:

permissions:
contents: read

jobs:
unit-tests:
runs-on: ${{ matrix.operating-system }}
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
Expand Down Expand Up @@ -52,6 +49,12 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
# pages:write is required to deploy to GitHub pages.
pages: write
# id-token:write is required to deploy to GitHub pages.
id-token: write
steps:
- name: Deploy to GitHub Pages
id: deployment
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release-unsigned-phar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ name: "Release unsigned PHAR"
on:
workflow_call:

jobs:
permissions:
contents: read

jobs:
build-phar:
runs-on: ${{ matrix.operating-system }}
strategy:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
types:
- published

permissions:
contents: read

jobs:
release-phar:
runs-on: ${{ matrix.operating-system }}
Expand All @@ -14,6 +17,9 @@ jobs:
- ubuntu-latest
php-versions:
- '8.1'
permissions:
# contents:write is required to upload the binaries to the release.
contents: write
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down

0 comments on commit 17ca9d5

Please sign in to comment.