Files
llvm-project/.github/workflows/issue-release-workflow.yml
Tom Stellard 7ea78deff2 Revert "workflows/issue-release-workflow: Use GitHub app for generating tokens" (#194058)
Reverts llvm/llvm-project#193825

Fails due to insufficient permissions:

`
github.GithubException.GithubException: 422 {"message": "Validation
Failed", "errors": [{"resource": "PullRequest", "code": "custom",
"field": "fork_collab", "message": "fork_collab Fork collab can't be
granted by someone without permission"}], "documentation_url":
"https://docs.github.com/rest/pulls/pulls#create-a-pull-request",
"status": "422"}
`
2026-04-24 14:02:08 -07:00

71 lines
2.3 KiB
YAML

# This contains the workflow definitions that allow users to test backports
# to the release branch using comments on issues.
#
# /cherry-pick <commit> <...>
#
# This comment will attempt to cherry-pick the given commits to the latest
# release branch (release/Y.x) and if successful, push the result to a branch
# on github.
#
# /branch <owner>/<repo>/<branch>
#
# This comment will create a pull request from <branch> to the latest release
# branch.
name: Issue Release Workflow
permissions:
contents: read
on:
issue_comment:
types:
- created
- edited
issues:
types:
- opened
env:
COMMENT_BODY: ${{ github.event.action == 'opened' && github.event.issue.body || github.event.comment.body }}
jobs:
backport-commits:
name: Backport Commits
runs-on: ubuntu-24.04
environment: main-branch-only
permissions:
issues: write
pull-requests: write
if: >-
(github.repository == 'llvm/llvm-project') &&
!startswith(github.event.comment.body, '<!--IGNORE-->') &&
contains(github.event.action == 'opened' && github.event.issue.body || github.event.comment.body, '/cherry-pick')
steps:
- name: Fetch LLVM sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: llvm/llvm-project
# GitHub stores the token used for checkout and uses it for pushes
# too, but we want to use a different token for pushing, so we need
# to disable persist-credentials here.
persist-credentials: false
fetch-depth: 0
- name: Setup Environment
run: |
pip install --require-hashes -r ./llvm/utils/git/requirements.txt
./llvm/utils/git/github-automation.py --token ${{ github.token }} setup-llvmbot-git
- name: Backport Commits
run: |
printf "%s" "$COMMENT_BODY" |
./llvm/utils/git/github-automation.py \
--repo "$GITHUB_REPOSITORY" \
--token "${{ secrets.RELEASE_WORKFLOW_PR_CREATE }}" \
release-workflow \
--branch-repo-token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \
--issue-number ${{ github.event.issue.number }} \
--requested-by ${{ (github.event.action == 'opened' && github.event.issue.user.login) || github.event.comment.user.login }} \
auto