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

GitHub actions: move permissions down to the jobs #29019

Merged
merged 1 commit into from
May 7, 2024
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
3 changes: 1 addition & 2 deletions .github/workflows/auto-assign-pr-to-author.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ on:
pull_request:
types: [opened]

permissions:
contents: read
permissions: {}

jobs:
add-reviews:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/check-bad-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ on:
- opened
- synchronize

permissions: {}

jobs:
check_pr_commits:
permissions:
contents: read
runs-on: ubuntu-latest

steps:
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ on:
schedule:
- cron: '0 5 * * *'

permissions:
contents: read
permissions: {}

jobs:
CodeQL-Build:

permissions:
actions: read # for github/codeql-action/init to get workflow details
contents: read # for actions/checkout to fetch code
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/contributor-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ concurrency:
group: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/release' ) && format('contributor-pr-base-{0}', github.sha) || format('contributor-pr-{0}', github.ref) }}
cancel-in-progress: true


env:
# Set the DEVELOCITY_ACCESS_KEY so that Gradle Build Scans are generated
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
# Enable debug for the `gradle-build-action` cache operations
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true

permissions:
contents: read
permissions: {}

jobs:
build:
name: "Compile All"
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: git clone
Expand Down Expand Up @@ -62,6 +62,8 @@ jobs:

sanity-check:
name: "Sanity Check on Linux"
permissions:
contents: read
runs-on: ubuntu-latest
needs: build
steps:
Expand All @@ -84,6 +86,8 @@ jobs:

unit-test:
name: "${{ matrix.bucket.name }} (Unit Test)"
permissions:
contents: read
runs-on: ubuntu-latest
needs: build
strategy:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/feedback.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ on:
- cron: '0 * * * *' # every hour
workflow_dispatch:

permissions: {}

jobs:
feedback:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
# Feedback loop: ask for something on PR/Issue and close if not provided or return to the queue on update.
# https://github.com/gradle/issue-management-action/blob/main/src/feedback.ts
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/issue-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ on:
issues:
types: [ opened, unlabeled, closed ]

permissions: {}

jobs:
check_issue_metadata:
runs-on: ubuntu-latest
permissions:
issues: write
runs-on: ubuntu-latest
steps:
# Check that issues have proper metadata: labels and milestone
# https://github.com/gradle/issue-management-action/blob/main/src/issue-metadata.ts
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/notify-on-rc-for-manual-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
tags:
- 'v*.*.*-RC1'

permissions: {}

jobs:
send-slack-notification:
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pull-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ on:
pull_request_target:
types: [ closed ]

permissions: {}

jobs:
check_pull_metadata:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
# Check that PRs have proper metadata: labels and milestone
# https://github.com/gradle/issue-management-action/blob/main/src/pull-metadata.ts
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/slack-notifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
types:
- labeled

permissions: {}

jobs:
send-slack-notification:
if: ${{ github.event.label.name == 'in:ide' || github.event.label.name == 'in:eclipse-plugin' || github.event.label.name == 'in:idea-plugin' || github.event.label.name == 'in:tooling-api' }}
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/stale-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ on:
# Execute every hour at xx:05 to avoid conflicts with other workflows
- cron: '5 * * * *'

permissions:
pull-requests: write
permissions: {}

jobs:
stale:
permissions:
pull-requests: write

runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/submit-github-dependency-graph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ on:
branches:
- master

permissions:
contents: write
permissions: {}

jobs:
generate-and-submit:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/team-triage-stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ on:
# Execute every day at 00:05 to avoid conflicts with other workflows
- cron: '5 0 * * *'

permissions:
issues: write
pull-requests: write
permissions: {}

jobs:
requeue:
permissions:
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
Expand Down