[Workflow] Try to fix code-formatter failing to find changes in some cases.
[llvm-project.git] / .github / workflows / issue-release-workflow.yml
blobb09ef6555fa9017cc8e1262773395fc39d693bde
1 # This contains the workflow definitions that allow users to test backports
2 # to the release branch using comments on issues.
4 # /cherry-pick <commit> <...>
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.
10 # /branch <owner>/<repo>/<branch>
12 # This comment will create a pull request from <branch> to the latest release
13 # branch.
15 name: Issue Release Workflow
17 permissions:
18   contents: read
20 on:
21   issue_comment:
22     types:
23       - created
24       - edited
25   issues:
26     types:
27       - opened
29 env:
30   COMMENT_BODY: ${{ github.event.action == 'opened' && github.event.issue.body || github.event.comment.body  }}
32 jobs:
33   backport-commits:
34     name: Backport Commits
35     runs-on: ubuntu-latest
36     if: >-
37       (github.repository == 'llvm/llvm-project') &&
38       !startswith(github.event.comment.body, '<!--IGNORE-->') &&
39       contains(github.event.action == 'opened' && github.event.issue.body || github.event.comment.body, '/cherry-pick')
40     steps:
41       - name: Fetch LLVM sources
42         uses: actions/checkout@v4
43         with:
44           repository: llvm/llvm-project
45           # GitHub stores the token used for checkout and uses it for pushes
46           # too, but we want to use a different token for pushing, so we need
47           # to disable persist-credentials here.
48           persist-credentials: false
49           fetch-depth: 0
51       - name: Setup Environment
52         run: |
53           pip install -r ./llvm/utils/git/requirements.txt
54           ./llvm/utils/git/github-automation.py --token ${{ github.token }} setup-llvmbot-git
56       - name: Backport Commits
57         run: |
58           printf "%s" "$COMMENT_BODY" |
59           ./llvm/utils/git/github-automation.py \
60           --repo "$GITHUB_REPOSITORY" \
61           --token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \
62           release-workflow \
63           --issue-number ${{ github.event.issue.number }} \
64           --phab-token ${{ secrets.RELEASE_WORKFLOW_PHAB_TOKEN }} \
65           auto
67   create-pull-request:
68     name: Create Pull Request
69     runs-on: ubuntu-latest
70     if: >-
71       (github.repository == 'llvm/llvm-project') &&
72       !startswith(github.event.comment.body, '<!--IGNORE-->') &&
73       contains(github.event.comment.body, '/branch ')
75     steps:
76       - name: Fetch LLVM sources
77         uses: actions/checkout@v4
78         with:
79           persist-credentials: false
81       - name: Setup Environment
82         run: |
83           pip install -r ./llvm/utils/git/requirements.txt
85       - name: Create Pull Request
86         run: |
87           printf "%s" "$COMMENT_BODY" |
88           ./llvm/utils/git/github-automation.py \
89           --repo "$GITHUB_REPOSITORY" \
90           --token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \
91           release-workflow \
92           --issue-number ${{ github.event.issue.number }} \
93           --phab-token ${{ secrets.RELEASE_WORKFLOW_PHAB_TOKEN }} \
94           auto