]> code.ossystems Code Review - meta-freescale.git/commitdiff
cicd: Use pull_request_target instead of pull_request 824/head
authorVinicius Aquino <vinicius.aquino@ossystems.com.br>
Tue, 6 Jul 2021 20:07:16 +0000 (17:07 -0300)
committerVinicius Aquino <vinicius.aquino@ossystems.com.br>
Wed, 7 Jul 2021 11:46:38 +0000 (08:46 -0300)
When a PR comes from a forked repo, use pull_request_target as event
type instead of pull_request.

Signed-off-by: Vinicius Aquino <vinicius.aquino@ossystems.com.br>
.github/workflows/backport.yaml

index 432453011284cdd3f0f414d3152ac7b5f8ba8a46..54dce5bc093d3cf74972c70cc4079c172b0d2be9 100644 (file)
@@ -1,6 +1,6 @@
 name: Backport labeled merged pull requests
 on:
-  pull_request:
+  pull_request_target:
     types: [closed]
   issue_comment:
     types: [created]
@@ -12,11 +12,11 @@ jobs:
     # or when a comment containing `/backport` is created
     if: >
       (
-        github.event_name == 'pull_request' &&
-        github.event.pull_request.merged
+        github.event_name == 'pull_request_target' &&
+        github.event.pull_request_target.merged
       ) || (
         github.event_name == 'issue_comment' &&
-        github.event.issue.pull_request &&
+        github.event.issue.pull_request_target &&
         contains(github.event.comment.body, '/backport')
       )
     steps: