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

fix: workflow permissions #54

Merged
merged 10 commits into from
Mar 16, 2023
6 changes: 2 additions & 4 deletions .github/workflows/get-terraform-dir.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ permissions:

jobs:
terraform-directory:
permissions:
contents: read
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
Expand All @@ -22,11 +20,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
persist-credentials: false
persist-credentials: true # changed-files unable to authenticate if false

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@04124efe7560d15e11ea2ba96c0df2989f68f1f4 # v35.6.1
uses: tj-actions/changed-files@v35.5.6

- name: List all changed files
run: |
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@ on:
type: number

# Declare default permissions as read only.
permissions: read-all
permissions:
contents: read

jobs:
find-terraform:
uses: ./.github/workflows/get-terraform-dir.yaml
permissions:
contents: read

lint:
permissions:
contents: read
runs-on: ubuntu-latest
timeout-minutes: 10
concurrency:
Expand All @@ -31,7 +28,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
persist-credentials: false
persist-credentials: true # lint fails to authenticate when false

- name: Setup Terraform
if: ${{ needs.find-terraform.outputs.terraform-dir != '' }}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/pr-title.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ on:
workflow_call: {}

# Declare default permissions as read only.
permissions: read-all
permissions:
pull-requests: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
conventional-pr-title:
permissions:
pull-requests: read
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/semantic-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
branches: [main]

# Declare default permissions as read only.
permissions: read-all
permissions:
contents: read

jobs:
get-temp-token:
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/tfsec-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ on:
type: string

# Declare default permissions as read only.
permissions: read-all
permissions:
contents: read

jobs:
find-terraform:
permissions:
contents: read
uses: ./.github/workflows/get-terraform-dir.yaml

tfsec-pr-commenter:
permissions:
pull-requests: write
contents: read
runs-on: ubuntu-latest
timeout-minutes: 10
concurrency:
Expand Down