Skip to content

Commit

Permalink
Fix permissions documentation (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
omus authored Nov 21, 2024
1 parent dc62ca8 commit 656c4f5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
test-default-name:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
steps:
- uses: actions/checkout@v4
Expand All @@ -30,6 +31,7 @@ jobs:
name: Custom Name
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
steps:
- uses: actions/checkout@v4
Expand All @@ -50,6 +52,7 @@ jobs:
name: ""
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
steps:
- uses: actions/checkout@v4
Expand All @@ -70,6 +73,7 @@ jobs:
name: null
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
steps:
- uses: actions/checkout@v4
Expand All @@ -90,6 +94,7 @@ jobs:
name: false
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -194,6 +199,7 @@ jobs:
name: ${{ github.job }}
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
strategy:
fail-fast: false
Expand Down Expand Up @@ -226,6 +232,7 @@ jobs:
name: Embedded
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
steps:
- id: dynamic-job
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ jobs:
# These permissions are needed to:
# - Use `job-context`: https://github.com/beacon-biosignals/job-context#permissions
permissions:
context: read
actions: read
contents: read
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -46,9 +47,10 @@ The `job-context` action does not support any inputs.

## Permissions

The follow [job permissions](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs) are required to run this action:
The following [job permissions](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs) are required to run this action:

```yaml
permissions:
context: read
actions: read # Required for non-public repositories
contents: read
```
1 change: 1 addition & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ runs:
[[ "$RUNNER_DEBUG" -eq 1 ]] && set -x
set -euo pipefail
# https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#get-a-workflow-run-attempt
jobs="$(gh api -X GET "/repos/{owner}/{repo}/actions/runs/${run_id:?}/attempts/${run_attempt:?}/jobs")"
job_ids="$(jq -c --arg name "$job_name" '[.jobs[] | select(.name == $name) | .id]' <<<"${jobs}")"
Expand Down

0 comments on commit 656c4f5

Please sign in to comment.