Skip to content
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

ci: Set permissions for GitHub actions #2662

Merged
merged 5 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@ on:
schedule:
- cron: "0 23 * * 0"

permissions:
contents: read

jobs:
analyze:
permissions:
actions: read # for github/codeql-action/init to get workflow details
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/analyze to upload SARIF results
name: Analyze
runs-on: ubuntu-latest

Expand All @@ -31,3 +38,4 @@ jobs:

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
# cspell:ignore SARIF
6 changes: 6 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ on:
- ".github/workflows/coverage.yml"
- "!docs/**"

permissions:
contents: read

jobs:
coverage:
permissions:
checks: write # for coverallsapp/github-action to create new checks
contents: read # for actions/checkout to fetch code
runs-on: ubuntu-latest

steps:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/cspell-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- main

permissions:
contents: read

jobs:
cspell:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/cspell-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
# Run on demand
workflow_dispatch:

permissions:
contents: read

jobs:
cspell:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/cspell4-integration-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
schedule:
- cron: "0 9 * * 1"

permissions:
contents: read

jobs:
update-dependencies:
if: github.repository_owner == 'streetsidesoftware'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ on:
# Run on demand
workflow_dispatch:

permissions:
contents: read

jobs:
integration-tests:
runs-on: ${{ matrix.os }}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/issues-lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ on:
- cron: "30 5 * * *"
workflow_dispatch:

permissions:
contents: read

jobs:
stale:
permissions:
issues: write # for dessant/lock-threads to lock issues
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v3.0.0
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lint-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
paths:
- "docs/**"

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
paths-ignore:
- "docs/**"

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ on:
default: next
required: true

permissions:
contents: read

jobs:
stub:
permissions:
contents: none
runs-on: ubuntu-latest
steps:
- run: echo "Publish Stub"
Expand Down
33 changes: 32 additions & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,38 @@ on:
# Run on demand
workflow_dispatch:

permissions:
contents: read

jobs:
update_pr_labels:
if: github.ref != 'refs/heads/main'
permissions:
pull-requests: write # for release-drafter/release-drafter to add label to PR
runs-on: ubuntu-latest
steps:
# (Optional) GitHub Enterprise requires GHE_HOST variable set
#- name: Set GHE_HOST
# run: |
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV

# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
# disable-autolabeler: true
with:
# See [Release Drafter is *sometimes* including unmerged PRs · Issue #917 · release-drafter/release-drafter](https://github.com/release-drafter/release-drafter/issues/917)
disable-releaser: true
disable-autolabeler: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

update_release_draft:
if: github.ref == 'refs/heads/main'
permissions:
contents: write # needed by release-drafter/release-drafter to write to the draft release.
runs-on: ubuntu-latest
steps:
# (Optional) GitHub Enterprise requires GHE_HOST variable set
Expand All @@ -29,7 +59,8 @@ jobs:
# disable-autolabeler: true
with:
# See [Release Drafter is *sometimes* including unmerged PRs · Issue #917 · release-drafter/release-drafter](https://github.com/release-drafter/release-drafter/issues/917)
disable-releaser: github.ref != 'refs/heads/main'
disable-releaser: false
disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# cspell:ignore auto* *labeler
3 changes: 3 additions & 0 deletions .github/workflows/test-build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- main

permissions:
contents: read

jobs:
test-build-docs:
runs-on: ${{ matrix.os }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
paths-ignore:
- "docs/**"

permissions:
contents: read

jobs:
test-node-versions:
runs-on: ${{ matrix.os }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/update-dependencies-cspell4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ on:
schedule:
- cron: "0 12 * * 0"

permissions:
contents: read

jobs:
update-dependencies:
if: github.repository_owner == 'streetsidesoftware'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ on:
schedule:
- cron: "0 12 * * 0"

permissions:
contents: read

jobs:
update-dependencies:
if: github.repository_owner == 'streetsidesoftware'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
- "packages/cspell-types/**/*.ts"
workflow_dispatch:

permissions:
contents: read

jobs:
update-dependencies:
if: github.repository_owner == 'streetsidesoftware'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/update-integration-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
schedule:
- cron: "0 8 * * 1" # Monday at 8 UTC

permissions:
contents: read

jobs:
update:
if: github.repository_owner == 'streetsidesoftware'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
default: main
required: true

permissions:
contents: read

jobs:
version:
runs-on: ubuntu-latest
Expand Down