build(deps): bump anchore/scan-action from 4 to 6 #879
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: backport | |
on: | |
pull_request_target: | |
types: | |
- closed | |
- labeled | |
jobs: | |
backport_and_merge: | |
runs-on: ubuntu-latest | |
# Only react to merged PRs for security reasons. | |
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target. | |
permissions: | |
contents: write | |
pull-requests: write | |
if: | | |
github.event.pull_request.merged && ( | |
github.event.action == 'closed' || ( | |
github.event.action == 'labeled' && contains(github.event.label.name, 'backport') | |
) | |
) | |
steps: | |
- name: backport PR | |
uses: tibdex/backport@v2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
title_template: "[AUTO-BACKPORT <%= base %>] <%= number %>: <%= title %>" | |
- name: merge backported PR | |
id: merge_backport_pr | |
if: success() | |
run: | | |
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --search "[AUTO-BACKPORT release-[0-9.]+ ] ${{ github.event.pull_request.number }}" --json number --jq '.[0].number') | |
if [ -n "$PR_NUMBER" ]; then | |
tools/scripts/track-pr pr-${{ github.event.action }} "$PR_NUMBER" | |
gh pr merge $PR_NUMBER --merge --repo ${{ github.repository }} --admin -t "Auto-merged backport PR." | |
else | |
echo "No backport PR found to merge." | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |