Skip to content

ci: explicit permissions in actions #1052

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
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
- rc
workflow_dispatch:

permissions:
contents: read
pull-requests: write

jobs:
test:
name: Test / OS ${{ matrix.os }} / Node ${{ matrix.node }}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ on:
branches-ignore: # Run the checks on all branches but the protected ones
- master
- release/*

pull_request_target:
pull_request:
branches:
- master
- release/*
Expand All @@ -31,7 +30,7 @@ jobs:
sparse-checkout: |
.github

- if: ${{ github.event_name == 'pull_request_target' }}
- if: ${{ github.event_name == 'pull_request' }}
run: |
set -ex
TMP_FILE=$(mktemp)
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
- master
workflow_dispatch:

permissions:
contents: write
pages: write

jobs:
docs:
name: Publish docs / OS ${{ matrix.os }} / Node ${{ matrix.node }}
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/dogfooding.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ on:
pull_request_review:
types: [submitted, edited]

pull_request_target:
pull_request:
types:
- opened
branches:
- '*'

permissions:
contents: read

jobs:
check_dogfooding:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/manual-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ on:
type: string
required: true

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- master
- release/*

permissions:
contents: read

jobs:
release_please:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -54,7 +57,7 @@ jobs:
# release-please only ignores releases that have a form like [A-Z0-9]<version>, so prefixing with rc<version>
RELEASE_NAME="rc$RELEASE_VERSION"
else
MAIN_RELEASE_VERSION=${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
MAIN_RELEASE_VERSION="${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}"
RELEASE_VERSION="$MAIN_RELEASE_VERSION"
RELEASE_NAME="v$RELEASE_VERSION"
fi
Expand Down Expand Up @@ -125,7 +128,7 @@ jobs:
PR_NUMBER='${{ steps.release.outputs.pr && fromJSON(steps.release.outputs.pr).number }}'

GH_TOKEN='${{ github.token }}' gh release \
create $RELEASE_NAME \
create "$RELEASE_NAM"E \
--title "v$RELEASE_VERSION" \
--prerelease \
-n "This is a release candidate. See release-please PR #$PR_NUMBER for context."
Expand Down
Loading