Skip to content

Commit

Permalink
ci: skip jobs unless needed
Browse files Browse the repository at this point in the history
Signed-off-by: knqyf263 <knqyf263@gmail.com>
  • Loading branch information
knqyf263 committed Jun 5, 2024
1 parent 639996e commit 458fafc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/backport.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,24 @@ on:
jobs:
backport:
name: Backport PR
# Only run the job if the pull request has been merged
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Check for specific label prefix
id: label_check
env:
LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }}
run: |
echo "Found labels: $LABELS"
if echo "$LABELS" | jq 'any(startswith("backport-to-"))'; then
echo "match=true" >> $GITHUB_OUTPUT
else
echo "match=false" >> $GITHUB_OUTPUT
fi
- name: Backport Action
if: steps.label_check.outputs.match == 'true'
uses: sorenlouv/backport-github-action@v9.5.1
with:
github_token: ${{ secrets.ORG_REPO_TOKEN }}
Expand Down

0 comments on commit 458fafc

Please sign in to comment.