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