]> code.ossystems Code Review - meta-freescale.git/commitdiff
cicd: backport: update workflow based on new 0.0.4
authorVinicius Aquino <vinicius.aquino@ossystems.com.br>
Thu, 17 Jun 2021 21:22:05 +0000 (18:22 -0300)
committerOtavio Salvador <otavio@ossystems.com.br>
Fri, 18 Jun 2021 13:18:41 +0000 (10:18 -0300)
The new release allow the use of pull request comments
to trigger the backport process.

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

index a39e7e589eb680f9957609b1c17b5602b2eb4caf..432453011284cdd3f0f414d3152ac7b5f8ba8a46 100644 (file)
@@ -1,23 +1,38 @@
-name: Backport
+name: Backport labeled merged pull requests
 on:
-  pull_request_target:
-    types: [closed, labeled]
+  pull_request:
+    types: [closed]
+  issue_comment:
+    types: [created]
 jobs:
-  backport:
-    name: Backport Pull Request
-    if: github.repository_owner == 'Freescale' && github.event.pull_request.merged == true
+  build:
+    name: Create backport PRs
     runs-on: ubuntu-latest
+    # Only run when pull request is merged
+    # or when a comment containing `/backport` is created
+    if: >
+      (
+        github.event_name == 'pull_request' &&
+        github.event.pull_request.merged
+      ) || (
+        github.event_name == 'issue_comment' &&
+        github.event.issue.pull_request &&
+        contains(github.event.comment.body, '/backport')
+      )
     steps:
       - uses: actions/checkout@v2
         with:
-          # required to find all branches
+          # Required to find all branches
           fetch-depth: 0
-          ref: ${{ github.event.pull_request.head.sha }}
       - name: Create backport PRs
-        # should be kept in sync with `version`
-        uses: zeebe-io/backport-action@9b8949dcd4295d364b0939f07d0c7593598d26cd
+        # Should be kept in sync with `version`
+        uses: zeebe-io/backport-action@v0.0.4
         with:
+          # Required
+          # Version of the backport-action
+          # Must equal the version in `uses`
+          # Recommended: latest tag or `master`
+          version: v0.0.4
+
           github_token: ${{ secrets.GITHUB_TOKEN }}
           github_workspace: ${{ github.workspace }}
-          # should be kept in sync with `uses`
-          version: 9b8949dcd4295d364b0939f07d0c7593598d26cd