mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
infra/workflow: Reduce workflow permissions
By explicitly listing the permissions required in general, repositories without restrictive permissions will only allocate the specified permissions which is much safer than the default, fairly wide, permissions grant. Most workflows don't appear to need any permissions beyond `contents: read` which is required for checkout (when a repository is private). By specifying this permission, it tells GitHub not to include any of its additional default permissions (when a repository is configured permissively). The .github/workflows/memcheck_*.sh scripts called by build_ubuntu.yml require write permissions in order to post their output to a pull request (as a comment). In locked down GitHub repositories, unless a workflow/job asks for write permissions, it will not have them and such API calls will result in: { "message": "Resource not accessible by integration", "documentation_url": "https://docs.github.com/rest/issues/comments#create-an-issue-comment", "status": "403" } By specifically requesting the permissions, the workflow will continue to work as expected.
This commit is contained in:
parent
8663e33353
commit
effb58fc63
5 changed files with 19 additions and 0 deletions
3
.github/workflows/build_android.yml
vendored
3
.github/workflows/build_android.yml
vendored
|
@ -8,6 +8,9 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_x86_64:
|
build_x86_64:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
3
.github/workflows/build_ios.yml
vendored
3
.github/workflows/build_ios.yml
vendored
|
@ -8,6 +8,9 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_x86_64:
|
build_x86_64:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
|
3
.github/workflows/build_macos.yml
vendored
3
.github/workflows/build_macos.yml
vendored
|
@ -8,6 +8,9 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
|
7
.github/workflows/build_ubuntu.yml
vendored
7
.github/workflows/build_ubuntu.yml
vendored
|
@ -8,6 +8,9 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -45,6 +48,10 @@ jobs:
|
||||||
|
|
||||||
unit_test:
|
unit_test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
|
3
.github/workflows/build_windows.yml
vendored
3
.github/workflows/build_windows.yml
vendored
|
@ -8,6 +8,9 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
Loading…
Add table
Reference in a new issue