Skip to content

Commit abf61e3

Browse files
authored
ci(github-actions): Add read permissions to CI workflow (#55)
Explicitly grant `contents: read` to the CI workflow. This is a security best practice and ensures that actions requiring repository content access (e.g., checkout) function correctly without relying on default permissions.
1 parent a874a2c commit abf61e3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#
1212

1313
name: CI
14+
permissions:
15+
contents: read
1416

1517
on:
1618
pull_request:

src/PHPUnit/TraitGithubActions.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ public static function testGithubActionsWorkflow(): void
3535

3636
// Expected
3737
$expected = [
38-
'name' => 'CI',
39-
'on' => [
38+
'name' => 'CI',
39+
'permissions' => [
40+
'contents' => 'read',
41+
],
42+
'on' => [
4043
'pull_request' => ['branches' => ['*']],
4144
'push' => ['branches' => ['master']],
4245
],

0 commit comments

Comments
 (0)