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 --phab-token ${{ secrets.RELEASE_WORKFLOW_PHAB_TOKEN }} \ 62 auto 63 64 create-pull-request: 65 name: Create Pull Request 66 runs-on: ubuntu-20.04 67 if: >- 68 (github.repository == 'llvm/llvm-project') && 69 !startswith(github.event.comment.body, '<!--IGNORE-->') && 70 contains(github.event.comment.body, '/branch') 71 72 steps: 73 - name: Fetch LLVM sources 74 uses: actions/checkout@v2 75 76 - name: Setup Environment 77 run: | 78 pip install -r ./llvm/utils/git/requirements.txt 79 80 - name: Create Pull Request 81 run: | 82 printf "$COMMENT_BODY" | 83 ./llvm/utils/git/github-automation.py \ 84 --repo $GITHUB_REPOSITORY \ 85 --token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \ 86 release-workflow \ 87 --issue-number ${{ github.event.issue.number }} \ 88 auto 89