1# This contains the workflow definitions that allow users to test backports 2# 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 latest 7# release branch (release/Y.x) and if successful, push the result to a branch 8# on github. 9# 10# /branch <owner>/<repo>/<branch> 11# 12# This comment will create a pull request from <branch> to the latest release 13# branch. 14 15name: Issue Release Workflow 16 17permissions: 18 contents: read 19 20on: 21 issue_comment: 22 types: 23 - created 24 - edited 25 issues: 26 types: 27 - opened 28 29env: 30 COMMENT_BODY: ${{ github.event.action == 'opened' && github.event.issue.body || github.event.comment.body }} 31 32jobs: 33 backport-commits: 34 name: Backport Commits 35 runs-on: ubuntu-latest 36 permissions: 37 issues: write 38 pull-requests: write 39 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 sources 45 uses: actions/checkout@v4 46 with: 47 repository: llvm/llvm-project 48 # GitHub stores the token used for checkout and uses it for pushes 49 # too, but we want to use a different token for pushing, so we need 50 # to disable persist-credentials here. 51 persist-credentials: false 52 fetch-depth: 0 53 54 - name: Setup Environment 55 run: | 56 pip install --require-hashes -r ./llvm/utils/git/requirements.txt 57 ./llvm/utils/git/github-automation.py --token ${{ github.token }} setup-llvmbot-git 58 59 - name: Backport Commits 60 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 auto 70