mirror of
https://github.com/aquasecurity/trivy.git
synced 2026-01-31 13:53:14 +08:00
38 lines
1.3 KiB
YAML
38 lines
1.3 KiB
YAML
name: Automatic Backporting
|
|
|
|
on:
|
|
issue_comment:
|
|
types: [created]
|
|
|
|
jobs:
|
|
backport:
|
|
name: Backport PR
|
|
if: |
|
|
github.event.issue.pull_request &&
|
|
github.event.issue.pull_request.merged_at != null &&
|
|
startsWith(github.event.comment.body, '@aqua-bot backport release/') &&
|
|
(github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER')
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Extract branch name
|
|
run: |
|
|
BRANCH_NAME=$(echo ${{ github.event.comment.body }} | grep -oE '@aqua-bot backport\s+(\S+)' | awk '{print $3}')
|
|
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
|
|
|
|
- name: Set up Git user
|
|
run: |
|
|
git config --global user.email "actions@github.com"
|
|
git config --global user.name "GitHub Actions"
|
|
|
|
- name: Run backport script
|
|
run: ./misc/backport/backport.sh ${{ env.BRANCH_NAME }} ${{ github.event.issue.number }}
|
|
env:
|
|
# Use ORG_REPO_TOKEN instead of GITHUB_TOKEN
|
|
# This allows the created PR to trigger tests and other workflows
|
|
GITHUB_TOKEN: ${{ secrets.ORG_REPO_TOKEN }} |