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 17on: 18 issue_comment: 19 types: 20 - created 21 - edited 22 issues: 23 types: 24 - opened 25 26env: 27 COMMENT_BODY: ${{ github.event.action == 'opened' && github.event.issue.body || github.event.comment.body }} 28 29jobs: 30 backport-commits: 31 name: Backport Commits 32 runs-on: ubuntu-20.04 33 if: >- 34 (github.repository == 'llvm/llvm-project') && 35 !startswith(github.event.comment.body, '<!--IGNORE-->') && 36 contains(github.event.action == 'opened' && github.event.issue.body || github.event.comment.body, '/cherry-pick') 37 steps: 38 - name: Fetch LLVM sources 39 uses: actions/checkout@v2 40 with: 41 repository: llvm/llvm-project 42 # GitHub stores the token used for checkout and uses it for pushes 43 # too, but we want to use a different token for pushing, so we need 44 # to disable persist-credentials here. 45 persist-credentials: false 46 fetch-depth: 0 47 48 - name: Setup Environment 49 run: | 50 pip install -r ./llvm/utils/git/requirements.txt 51 ./llvm/utils/git/github-automation.py --token ${{ github.token }} setup-llvmbot-git 52 53 - name: Backport Commits 54 run: | 55 printf "$COMMENT_BODY" | 56 ./llvm/utils/git/github-automation.py \ 57 --repo $GITHUB_REPOSITORY \ 58 --token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \ 59 release-workflow \ 60 --issue-number ${{ github.event.issue.number }} \ 61 auto 62 63 create-pull-request: 64 name: Create Pull Request 65 runs-on: ubuntu-20.04 66 if: >- 67 (github.repository == 'llvm/llvm-project') && 68 !startswith(github.event.comment.body, '<!--IGNORE-->') && 69 contains(github.event.comment.body, '/branch') 70 71 steps: 72 - name: Fetch LLVM sources 73 uses: actions/checkout@v2 74 75 - name: Setup Environment 76 run: | 77 pip install -r ./llvm/utils/git/requirements.txt 78 79 - name: Create Pull Request 80 run: | 81 printf "$COMMENT_BODY" | 82 ./llvm/utils/git/github-automation.py \ 83 --repo $GITHUB_REPOSITORY \ 84 --token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \ 85 release-workflow \ 86 --issue-number ${{ github.event.issue.number }} \ 87 auto 88