Skip to content

Commit dad27f1

Browse files
committed
fix(ci): skip autolabeler in PR from forks
Following the reconmendation from the SUSE security team, the `pull_request_target` triggers from all our CI files have been removed. However, this trigger is required to allow the autolabeler action tagging PRs from forks. It's not possible to use `pull_request` only because Github by default set all the permissions to read-only for this trigger. Ignoring what it is defined in the CI file. Because of that, this commit updates the autolabeler CI workflow to skip the tagging when the PR came from a fork. Signed-off-by: José Guilherme Vanz <jguilhermevanz@suse.com>
1 parent 5e3e32a commit dad27f1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

.github/workflows/autolabeler.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@ name: Autolabeler
22

33
on:
44
pull_request:
5-
# Only following types are handled by the action, but one can default to all as well
65
types: [opened, reopened, synchronize, edited]
76

7+
permissions:
8+
contents: read
9+
810
jobs:
911
autolabeler:
12+
# Skip fork PRs — the GITHUB_TOKEN is read-only and cannot add labels
13+
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
1014
permissions:
11-
contents: read
1215
pull-requests: write
1316
runs-on: ubuntu-latest
1417
steps:

0 commit comments

Comments
 (0)