Skip to content

Commit b2d4eb3

Browse files
committed
chore(ci): separate permissions for build and publish jobs
1 parent ecac199 commit b2d4eb3

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

.github/workflows/publish.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
11
name: Publish
22

3-
43
on:
54
push:
65
branches:
76
- main
8-
9-
# Allows you to run this workflow manually from the Actions tab
107
workflow_dispatch:
11-
12-
# This gets called from the update-cli workflow
138
workflow_call:
149

15-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16-
permissions:
17-
contents: read
18-
pages: write
19-
id-token: write
20-
2110
jobs:
2211
build-and-upload:
12+
permissions:
13+
contents: read
2314
runs-on: ubuntu-latest
2415
steps:
2516
# Check out the content (source branch)
@@ -46,6 +37,9 @@ jobs:
4637
path: './public'
4738

4839
deploy:
40+
permissions:
41+
pages: write
42+
id-token: write
4943
environment:
5044
name: github-pages
5145
url: ${{ steps.deployment.outputs.page_url }}

.github/workflows/update-cli.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
name: Update CLI
22

33
on:
4+
workflow_dispatch:
45
schedule:
56
- cron: "14 2 * * *"
6-
workflow_dispatch:
7-
8-
permissions:
9-
contents: write
107

118
jobs:
129
update-cli:
@@ -16,6 +13,10 @@ jobs:
1613
steps:
1714
- name: Check out source
1815
uses: actions/checkout@v3
16+
- name: Setup git user
17+
run: |
18+
git config --global user.email "npm-cli+bot@github.com"
19+
git config --global user.name "npm CLI robot"
1920
- name: Use Node.js
2021
uses: actions/setup-node@v3
2122
with:
@@ -38,8 +39,6 @@ jobs:
3839
if: steps.status.outputs.has_changes == '1'
3940
run: |
4041
git add --verbose .
41-
git config user.name 'npm CLI robot'
42-
git config user.email 'npm-cli+bot@github.com'
4342
git commit -m 'CLI documentation update from CI'
4443
git push origin main
4544

0 commit comments

Comments
 (0)