Skip to content

Commit ff0df54

Browse files
authored
fix(chore): Tighten GA write access (#4774)
1 parent 2344721 commit ff0df54

File tree

5 files changed

+41
-82
lines changed

5 files changed

+41
-82
lines changed

.github/workflows/check-repro.yml

Lines changed: 0 additions & 82 deletions
This file was deleted.

.github/workflows/publish-each-pr.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Expo Preview
22
on: [pull_request]
33

4+
permissions:
5+
contents: read
6+
pull-requests: write
7+
48
jobs:
59
publish:
610
name: Install and publish

.github/workflows/stale.yml

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

7+
permissions:
8+
contents: read
9+
issues: write
10+
pull-requests: write
11+
712
jobs:
813
stale:
914
runs-on: ubuntu-latest

.github/workflows/triage.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ on:
33
issues:
44
types: [labeled]
55

6+
permissions:
7+
contents: read
8+
issues: write
9+
610
jobs:
711
needs-more-info:
812
runs-on: ubuntu-latest
@@ -13,6 +17,18 @@ jobs:
1317
with:
1418
github-token: ${{ secrets.GITHUB_TOKEN }}
1519
script: |
20+
const actor = context.actor;
21+
const { data: collaborators } = await github.rest.repos.listCollaborators({
22+
owner: context.repo.owner,
23+
repo: context.repo.repo,
24+
});
25+
26+
const isCollaborator = collaborators.some(collaborator => collaborator.login === actor);
27+
if (!isCollaborator) {
28+
console.log(`Actor ${actor} is not a collaborator, skipping workflow`);
29+
return;
30+
}
31+
1632
github.rest.issues.createComment({
1733
issue_number: context.issue.number,
1834
owner: context.repo.owner,
@@ -29,6 +45,18 @@ jobs:
2945
with:
3046
github-token: ${{ secrets.GITHUB_TOKEN }}
3147
script: |
48+
const actor = context.actor;
49+
const { data: collaborators } = await github.rest.repos.listCollaborators({
50+
owner: context.repo.owner,
51+
repo: context.repo.repo,
52+
});
53+
54+
const isCollaborator = collaborators.some(collaborator => collaborator.login === actor);
55+
if (!isCollaborator) {
56+
console.log(`Actor ${actor} is not a collaborator, skipping workflow`);
57+
return;
58+
}
59+
3260
github.rest.issues.createComment({
3361
issue_number: context.issue.number,
3462
owner: context.repo.owner,

.github/workflows/versions.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ on:
33
issues:
44
types: [opened, edited]
55

6+
permissions:
7+
contents: read
8+
issues: write
9+
610
jobs:
711
check-versions:
812
if: ${{ github.event.label.name == 'bug' }}

0 commit comments

Comments
 (0)