70 lines · yaml
1# This contains the workflow definitions that allow users to test backports2# to the release branch using comments on issues.3#4# /cherry-pick <commit> <...>5#6# This comment will attempt to cherry-pick the given commits to the latest7# release branch (release/Y.x) and if successful, push the result to a branch8# on github.9#10# /branch <owner>/<repo>/<branch>11#12# This comment will create a pull request from <branch> to the latest release13# branch.14 15name: Issue Release Workflow16 17permissions:18 contents: read19 20on:21 issue_comment:22 types:23 - created24 - edited25 issues:26 types:27 - opened28 29env:30 COMMENT_BODY: ${{ github.event.action == 'opened' && github.event.issue.body || github.event.comment.body }}31 32jobs:33 backport-commits:34 name: Backport Commits35 runs-on: ubuntu-24.0436 permissions:37 issues: write38 pull-requests: write39 if: >-40 (github.repository == 'llvm/llvm-project') &&41 !startswith(github.event.comment.body, '<!--IGNORE-->') &&42 contains(github.event.action == 'opened' && github.event.issue.body || github.event.comment.body, '/cherry-pick')43 steps:44 - name: Fetch LLVM sources45 uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.046 with:47 repository: llvm/llvm-project48 # GitHub stores the token used for checkout and uses it for pushes49 # too, but we want to use a different token for pushing, so we need50 # to disable persist-credentials here.51 persist-credentials: false52 fetch-depth: 053 54 - name: Setup Environment55 run: |56 pip install --require-hashes -r ./llvm/utils/git/requirements.txt57 ./llvm/utils/git/github-automation.py --token ${{ github.token }} setup-llvmbot-git58 59 - name: Backport Commits60 run: |61 printf "%s" "$COMMENT_BODY" |62 ./llvm/utils/git/github-automation.py \63 --repo "$GITHUB_REPOSITORY" \64 --token "${{ secrets.RELEASE_WORKFLOW_PR_CREATE }}" \65 release-workflow \66 --branch-repo-token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \67 --issue-number ${{ github.event.issue.number }} \68 --requested-by ${{ (github.event.action == 'opened' && github.event.issue.user.login) || github.event.comment.user.login }} \69 auto70