CI: add support to tag pr targeting stable branch
authorChristian Marangi <ansuelsmth@gmail.com>
Tue, 29 Nov 2022 18:53:23 +0000 (19:53 +0100)
committerChristian Marangi <ansuelsmth@gmail.com>
Thu, 1 Dec 2022 00:28:40 +0000 (01:28 +0100)
Add support to tag pr targeting stable branch matching the simple regex
of openwrt-[0-9][0-9].[0-9][0-9]. The tag that will be added will match
the pr target branch.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
.github/workflows/labeler.yml

index b67265ca80a4d8a785954aebe512b37885eb84bb..62a895a68b822f2be24e13c0fa83e48cb448d7e4 100644 (file)
@@ -17,3 +17,17 @@ jobs:
       - uses: actions/labeler@v4
         with:
           repo-token: '${{ secrets.GITHUB_TOKEN }}'
+
+      - name: Check Branch
+        id: check-branch
+        run: |
+          if echo "${{ github.base_ref }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then
+              echo "apply-tag=yes" >> $GITHUB_OUTPUT
+          fi
+
+      - uses: buildsville/add-remove-label@v2.0.0
+        if: ${{ steps.check-branch.outputs.apply-tag }}
+        with:
+          token: ${{secrets.GITHUB_TOKEN}}
+          labels: ${{ github.base_ref }}
+          type: add