Skip to content

Commit bab6c92

Browse files
authored
chore: add missing permissions to github workflows (#1564)
1 parent 4804da8 commit bab6c92

File tree

7 files changed

+116
-10
lines changed

7 files changed

+116
-10
lines changed

.github/workflows/audit.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
# Allows you to run this workflow manually from the Actions tab
55
workflow_dispatch:
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
validate-prod-core-dependencies:
912
name: Validate Core production dependencies

.github/workflows/deploy-docs.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Deploy Docs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
# Review gh actions docs if you want to further define triggers, paths, etc
8+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
9+
10+
# Ensure we avoid any race conditions with rapid pushes to main
11+
concurrency:
12+
group: "Deploy to GitHub Pages"
13+
cancel-in-progress: true
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
build:
20+
name: Build Docusaurus
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v6
24+
with:
25+
persist-credentials: false
26+
fetch-depth: 0
27+
- name: Use Node.js
28+
uses: actions/setup-node@v6
29+
with:
30+
node-version-file: ".node-version"
31+
- name: restore node_modules
32+
uses: actions/cache@v4
33+
with:
34+
path: |
35+
packages/node_modules
36+
key: ${{ runner.os }}-${{ hashFiles('packages/yarn.lock') }}
37+
- name: Prepare Environment
38+
run: |
39+
corepack enable
40+
41+
cd packages
42+
yarn config set cacheFolder /home/runner/publish-docs-cache
43+
yarn install
44+
yarn build:all
45+
env:
46+
CI: true
47+
- name: Run docusaurus
48+
run: |
49+
cd packages/documentation
50+
yarn docs:build
51+
env:
52+
CI: true
53+
- name: Run typedoc
54+
run: |
55+
cd packages
56+
yarn docs:typedoc
57+
cp docs documentation/build/typedoc -R
58+
env:
59+
CI: true
60+
61+
- name: Upload Build Artifact
62+
uses: actions/upload-pages-artifact@v4
63+
with:
64+
path: packages/documentation/build
65+
66+
deploy:
67+
name: Deploy to GitHub Pages
68+
needs: build
69+
70+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
71+
permissions:
72+
pages: write # to deploy to Pages
73+
id-token: write # to verify the deployment originates from an appropriate source
74+
75+
# Deploy to the github-pages environment
76+
environment:
77+
name: github-pages
78+
url: ${{ steps.deployment.outputs.page_url }}
79+
80+
runs-on: ubuntu-latest
81+
steps:
82+
- name: Deploy to GitHub Pages
83+
id: deployment
84+
uses: actions/deploy-pages@v4

.github/workflows/node.yaml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
pull_request:
1010
workflow_dispatch:
1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
1316
lint-core:
1417
name: Typecheck and Lint Core
@@ -103,6 +106,11 @@ jobs:
103106
name: Build Core and publish docker image
104107
runs-on: ubuntu-latest
105108
timeout-minutes: 30
109+
110+
permissions:
111+
contents: read
112+
packages: write
113+
106114
steps:
107115
- uses: actions/checkout@v6
108116
with:
@@ -283,6 +291,10 @@ jobs:
283291
matrix:
284292
gateway-name: [playout-gateway, mos-gateway, "live-status-gateway"]
285293

294+
permissions:
295+
contents: read
296+
packages: write
297+
286298
steps:
287299
- uses: actions/checkout@v6
288300
with:
@@ -613,12 +625,12 @@ jobs:
613625
env:
614626
CI: true
615627

616-
publish-docs:
617-
name: Publish Docs
628+
build-docs:
629+
name: Build Docs
618630
runs-on: ubuntu-latest
619-
continue-on-error: true
620631
timeout-minutes: 15
621632

633+
# This is just to ensure the docs build, another job performs the build & publish
622634
steps:
623635
- uses: actions/checkout@v6
624636
with:
@@ -656,13 +668,6 @@ jobs:
656668
cp docs documentation/build/typedoc -R
657669
env:
658670
CI: true
659-
- name: Publish
660-
if: github.ref == 'refs/heads/main' # always publish for just the main branch
661-
uses: peaceiris/actions-gh-pages@v4
662-
with:
663-
github_token: ${{ secrets.GITHUB_TOKEN }}
664-
publish_dir: ./packages/documentation/build
665-
force_orphan: true
666671

667672
check-for-multiple-library-versions:
668673
name: Check for multiple library versions

.github/workflows/prune-container-images.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
schedule:
66
- cron: "12 14 * * *"
77

8+
permissions:
9+
contents: read
10+
packages: write
11+
812
jobs:
913
prune-container-images:
1014
if: ${{ github.repository_owner == 'Sofie-Automation' }}

.github/workflows/prune-tags.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
schedule:
1515
- cron: "0 0 * * 0"
1616

17+
permissions:
18+
contents: write
19+
1720
jobs:
1821
prune-tags:
1922
if: ${{ github.repository_owner == 'Sofie-Automation' }}

.github/workflows/sonar.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
types: [opened, synchronize, reopened]
1010
workflow_dispatch:
1111

12+
permissions:
13+
contents: read
14+
1215
name: SonarCloud analysis
1316
jobs:
1417
sonarqube:

.github/workflows/trivy.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
schedule:
55
- cron: "0 10 * * 1"
66

7+
permissions:
8+
contents: read
9+
packages: read
10+
711
jobs:
812
trivy:
913
if: ${{ github.repository_owner == 'Sofie-Automation' }}

0 commit comments

Comments
 (0)