From 4c4956644a19e7eff1713ec882247acff67dae4d Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Fri, 2 Aug 2024 09:11:53 +0200 Subject: [PATCH 1/2] Add the possibility to let the action rebase the PR for you There are some cases where the following happens: 1. You create a PR, action-manifest-pr creates the manifest PR 2. The PR is merged. The action updates the PR. 3. A conflict occurs in the manifest-PR. This commit adds the possibility to add a comment to your PR that will automatically rebase the manifest-PR. This should work even if the PR is closed. Signed-off-by: Rubin Gerritsen --- action.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/action.yml b/action.yml index 026d3f8..04b4598 100644 --- a/action.yml +++ b/action.yml @@ -15,6 +15,10 @@ inputs: required: false type: string default: manifest-pr-skip + rebase-comment-string: + required: false + type: string + default: 'action-manifest-pr please rebase' manifest-pr-title-details: required: false type: string @@ -166,3 +170,14 @@ runs: set -e if (( $has_conflict == 1)) ; then git rebase upstream/main -X theirs ; fi git push origin auto-manifest-${{ github.event.repository.name }}-${{ github.event.pull_request.number }}:auto-manifest-${{ github.event.repository.name }}-${{ github.event.pull_request.number }} -f + + - name: Rebase manifest-PR on comment + if: ${{ github.event.action == 'created' }} && ${{ github.event.issue.pull_request }} && + contains(github.event.comment, inputs.rebase-comment-string)) ) + shell: bash + run: | + git checkout auto-manifest-${{ github.event.repository.name }}-${{ github.event.pull_request.number }} + git remote add upstream https://github.com/${{ inputs.target-repo }} + git fetch upstream + git rebase upstream/main -X theirs + git push origin auto-manifest-${{ github.event.repository.name }}-${{ github.event.pull_request.number }}:auto-manifest-${{ github.event.repository.name }}-${{ github.event.pull_request.number }} -f From 8fce059fe4918b429016d1f49b01e9b3c1f927bd Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Fri, 2 Aug 2024 09:22:51 +0200 Subject: [PATCH 2/2] Allow creating a manifest-PR using a comment at a later point There are some cases where the following happens: 1. You create a draft PR, you don't want to create the manifest PR yet. 2. You have checked the draft PR manually, now you want a manifest-PR This commit adds the possibility to create the manifest PR upon a comment to a PR. Signed-off-by: Rubin Gerritsen --- action.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 04b4598..7cf3480 100644 --- a/action.yml +++ b/action.yml @@ -15,6 +15,10 @@ inputs: required: false type: string default: manifest-pr-skip + create-pr-comment-string: + required: false + type: string + default: 'action-manifest-pr please create manifest-PR' rebase-comment-string: required: false type: string @@ -119,7 +123,9 @@ runs: # create actual manifest PR - name: Commit changed west.yml and create PR - if: ${{ github.event.action == 'opened' }} + if: ${{ github.event.action == 'opened' }} || + ( ${{ github.event.action == 'created' }} && ${{ github.event.issue.pull_request }} && + contains(github.event.comment, inputs.create-pr-comment-string)) ) shell: bash env: GH_TOKEN: ${{ inputs.token }}