diff --git a/.github/workflows/issue-release-workflow.yml b/.github/workflows/issue-release-workflow.yml index 17209ec055f85..112ece40bac9c 100644 --- a/.github/workflows/issue-release-workflow.yml +++ b/.github/workflows/issue-release-workflow.yml @@ -35,6 +35,7 @@ jobs: runs-on: ubuntu-latest permissions: issues: write + pull-requests: write if: >- (github.repository == 'llvm/llvm-project') && !startswith(github.event.comment.body, '') && @@ -65,35 +66,3 @@ jobs: --branch-repo-token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \ --issue-number ${{ github.event.issue.number }} \ auto - - create-pull-request: - name: Create Pull Request - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - if: >- - (github.repository == 'llvm/llvm-project') && - !startswith(github.event.comment.body, '') && - contains(github.event.comment.body, '/branch ') - - steps: - - name: Fetch LLVM sources - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Setup Environment - run: | - pip install -r ./llvm/utils/git/requirements.txt - - - name: Create Pull Request - run: | - printf "%s" "$COMMENT_BODY" | - ./llvm/utils/git/github-automation.py \ - --repo "$GITHUB_REPOSITORY" \ - --token ${{ github.token }} \ - release-workflow \ - --branch-repo-token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \ - --issue-number ${{ github.event.issue.number }} \ - auto diff --git a/llvm/docs/GitHub.rst b/llvm/docs/GitHub.rst index a89a4d955fc08..99c22f4b7220b 100644 --- a/llvm/docs/GitHub.rst +++ b/llvm/docs/GitHub.rst @@ -360,8 +360,8 @@ Releases Backporting Fixes to the Release Branches ----------------------------------------- You can use special comments on issues to make backport requests for the -release branches. This is done by making a comment containing one of the -following commands on any issue that has been added to one of the "X.Y.Z Release" +release branches. This is done by making a comment containing the following +command on any issue that has been added to one of the "X.Y.Z Release" milestones. :: @@ -374,10 +374,6 @@ apply cleanly, then a comment with a link to the failing job will be added to the issue. If the commit(s) do apply cleanly, then a pull request will be created with the specified commits. -:: - - /branch // - -This command will create a pull request against the latest release branch using -the from the / repository. cannot contain any -forward slash '/' characters. +If a commit you want to backport does not apply cleanly, you may resolve +the conflicts locally and then create a pull request against the release +branch. Just make sure to add the release milestone to the pull request. diff --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py index 72db9995b0e8a..897705166c640 100755 --- a/llvm/utils/git/github-automation.py +++ b/llvm/utils/git/github-automation.py @@ -308,6 +308,10 @@ def repo_name(self) -> str: def issue_number(self) -> int: return self._issue_number + @property + def branch_repo_owner(self) -> str: + return self.branch_repo_name.split("/")[0] + @property def branch_repo_name(self) -> str: return self._branch_repo_name @@ -394,7 +398,7 @@ def issue_notify_cherry_pick_failure( action_url = self.action_url if action_url: message += action_url + "\n\n" - message += "Please manually backport the fix and push it to your github fork. Once this is done, please add a comment like this:\n\n`/branch //`" + message += "Please manually backport the fix and push it to your github fork. Once this is done, please create a [pull request](https://github.com/llvm/llvm-project/compare)" issue = self.issue comment = issue.create_comment(message) issue.add_to_labels(self.CHERRY_PICK_FAILED_LABEL) @@ -472,9 +476,10 @@ def create_branch(self, commits: List[str]) -> bool: print("Pushing to {} {}".format(push_url, branch_name)) local_repo.git.push(push_url, "HEAD:{}".format(branch_name), force=True) - self.issue_notify_branch() self.issue_remove_cherry_pick_failed_label() - return True + return self.create_pull_request( + self.branch_repo_owner, self.repo_name, branch_name + ) def check_if_pull_request_exists( self, repo: github.Repository.Repository, head: str @@ -552,14 +557,6 @@ def execute_command(self) -> bool: commits = list(map(lambda a: extract_commit_hash(a), arg_list)) return self.create_branch(commits) - if command == "branch": - m = re.match("([^/]+)/([^/]+)/(.+)", args) - if m: - owner = m.group(1) - repo = m.group(2) - branch = m.group(3) - return self.create_pull_request(owner, repo, branch) - print("Do not understand input:") print(sys.stdin.readlines()) return False