Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[No QA] Resolve CP merge conflicts #3350

Merged
merged 6 commits into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions .github/workflows/cherryPick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,25 @@ jobs:
USER: OSBotify
TITLE_REGEX: Update version to ${{ env.NEW_VERSION }}

- name: Cherry-pick the merge commits to new branch
id: cherryPick
- name: Cherry-pick the version-bump to new branch
run: |
git fetch
git cherry-pick ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }} ${{ steps.getVersionBumpMergeCommit.outputs.MERGE_COMMIT_SHA }} --mainline 1
continue-on-error: true
git cherry-pick -x --mainline 1 --strategy=recursive -Xtheirs ${{ steps.getVersionBumpMergeCommit.outputs.MERGE_COMMIT_SHA }}

# If there is a merge conflict, we'll just commit what we have,
# and the PR will be auto-assigned for someone to manually resolve the conflicts.
- name: If there is a merge conflict...
if: ${{ steps.cherryPick.outcome == 'failure' }}
- name: Cherry-pick the merge commit of target PR to new branch
id: cherryPick
run: |
git add -A
git cherry-pick --continue
echo "Attempting to cherry-pick ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}"
if git cherry-pick -x --mainline 1 ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}; then
echo "🎉 No conflicts! CP was a success, PR can be automerged 🎉"
echo "::set-output name=SHOULD_AUTOMERGE::true"
roryabraham marked this conversation as resolved.
Show resolved Hide resolved
else
echo "😞 PR can't be automerged, there are merge conflicts in the following files:"
git --no-pager diff --name-only --diff-filter=U
git add .
GIT_MERGE_AUTOEDIT=no git cherry-pick --continue
echo "::set-output name=SHOULD_AUTOMERGE::false"
fi

- name: Create Pull Request
id: createPullRequest
Expand All @@ -135,7 +140,7 @@ jobs:
PULL_REQUEST_NUMBER: ${{ steps.createPullRequest.outputs.pr_number }}

- name: Auto-assign PR if there are merge conflicts
if: ${{ steps.cherryPick.outcome == 'failure' || steps.isPullRequestMergeable.outputs.IS_MERGEABLE == 'false' }}
if: ${{ steps.cherryPick.outputs.SHOULD_AUTOMERGE == 'false' || steps.isPullRequestMergeable.outputs.IS_MERGEABLE == 'false' }}
uses: actions-ecosystem/action-add-labels@a8ae047fee0ca28235f9764e1c478d2136dc15c1
with:
number: ${{ steps.createPullRequest.outputs.pr_number }}
Expand All @@ -144,7 +149,7 @@ jobs:
Hourly

- name: If PR has merge conflicts, comment with instructions for assignee
if: ${{ steps.cherryPick.outcome == 'failure' || steps.isPullRequestMergeable.outputs.IS_MERGEABLE == 'false' }}
if: ${{ steps.cherryPick.outputs.SHOULD_AUTOMERGE == 'false' || steps.isPullRequestMergeable.outputs.IS_MERGEABLE == 'false' }}
uses: actions-ecosystem/action-create-comment@cd098164398331c50e7dfdd0dfa1b564a1873fac
with:
github_token: ${{ secrets.OS_BOTIFY_TOKEN }}
Expand All @@ -157,7 +162,7 @@ jobs:
# TODO: Once https://github.com/hmarr/auto-approve-action/pull/186 is merged, point back at the non-forked repo
- name: Check for an auto approve
# Important: only auto-approve if there was no merge conflict!
if: ${{ steps.cherryPick.outcome == 'success' && steps.isPullRequestMergeable.outputs.IS_MERGEABLE == 'true' }}
if: ${{ steps.cherryPick.outputs.SHOULD_AUTOMERGE == 'true' && steps.isPullRequestMergeable.outputs.IS_MERGEABLE == 'true' }}
# Version: 2.0.0
uses: roryabraham/auto-approve-action@6bb4a3dcf07664d0131e1c74a4bc6d0d8c849978
with:
Expand All @@ -166,7 +171,7 @@ jobs:

- name: Check for an auto merge
# Important: only auto-merge if there was no merge conflict!
if: ${{ steps.cherryPick.outcome == 'success' && steps.isPullRequestMergeable.outputs.IS_MERGEABLE == 'true' }}
if: ${{ steps.cherryPick.outputs.SHOULD_AUTOMERGE == 'true' && steps.isPullRequestMergeable.outputs.IS_MERGEABLE == 'true' }}
# Version: 0.12.0
uses: pascalgn/automerge-action@39d831e1bb389bd242626bc25d4060064a97181c
env:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ jobs:
steps:
- name: Get merged pull request
id: getMergedPullRequest
uses: actions-ecosystem/action-get-merged-pull-request@59afe90821bb0b555082ce8ff1e36b03f91553d9
# TODO: Point back action actions-ecosystem after https://github.com/actions-ecosystem/action-get-merged-pull-request/pull/223 is merged
uses: roryabraham/action-get-merged-pull-request@7a7a194f6ff8f3eef58c822083695a97314ebec1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Check if merged pull request was an automatic version bump PR
id: isAutomatedPullRequest
run: echo "::set-output name=IS_AUTOMERGE_PR::${{ github.actor == 'OSBotify' }}"
run: echo "::set-output name=IS_AUTOMERGE_PR::${{ steps.getMergedPullRequest.outputs.author == 'OSBotify' }}"

deployStaging:
runs-on: ubuntu-latest
Expand Down