Skip to content

Commit 382f55e

Browse files
committed
update workflow for security
1 parent 245523f commit 382f55e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

.github/workflows/generate-ea.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@ jobs:
3030
id-token: write # Required for GCP authentication
3131

3232
steps:
33+
- name: Check commenter permissions
34+
if: github.event_name == 'issue_comment'
35+
uses: actions/github-script@v7
36+
with:
37+
script: |
38+
const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({
39+
owner: context.repo.owner,
40+
repo: context.repo.repo,
41+
username: context.actor
42+
});
43+
if (!['admin', 'write'].includes(permission.permission)) {
44+
core.setFailed('Only collaborators with write access can trigger this workflow');
45+
}
46+
console.log(`User ${context.actor} has ${permission.permission} permission`);
47+
3348
- name: Get PR details (for comment trigger)
3449
if: github.event_name == 'issue_comment'
3550
id: pr
@@ -52,7 +67,7 @@ jobs:
5267
token: ${{ github.token }}
5368

5469
- name: Install uv
55-
uses: astral-sh/setup-uv@v4
70+
uses: astral-sh/setup-uv@e4db8464a088ece1b920f60402e813ea4de65b8f # v4
5671

5772
- name: Set up Python
5873
uses: actions/setup-python@v5.2.0

0 commit comments

Comments
 (0)