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

Add merge-trunk-develop-pr action #71

Merged
merged 3 commits into from
Aug 7, 2023
Merged

Conversation

tomalec
Copy link
Member

@tomalec tomalec commented Aug 1, 2023

Changes proposed in this Pull Request:

Add merge-trunk-develop-pr action to create a PR to merge trunk to develop after a release done by woocommerce/grow/prepare-extension-release. As automerging with automerge-released-trunk may not work with branch protections.

Screenshots:

image

image

Detailed test instructions:

  1. Create a test repo that has the woocommerce/grow/prepare-extension-release set up.
  2. Add to trunk another workflow following the README https://github.com/woocommerce/grow/blob/add/merge-trunk-develop-pr/packages/github-actions/actions/merge-trunk-develop-pr/README.md but with the prereleased version actions-v1.9.1-pre
name: PR to merge a released trunk

on:
  pull_request:
    types:
      - closed
    branches:
      - trunk

jobs:
  automerge_trunk:
    runs-on: ubuntu-latest
    steps:
      - uses: woocommerce/grow/merge-trunk-develop-pr@@actions-v1.9.1-pre
  1. Create a develop branch
  2. Create a release with woocommerce/grow/prepare-extension-release. Then merge it - check that a PR to merge trunk to develop gets created. Like
  3. Create a release with woocommerce/grow/prepare-extension-release, switch a target branch to something else. Merge the PR. No PR should get created
  4. Create a release with woocommerce/grow/prepare-extension-release, close it without merging. No PR should get created
  5. Create a PR with release/1.2.3 as a regular user, then merge it to trunk. No PR should get created

Additional details:

  • Probably after merging this PR, we could tweak the PR checklist to mention using merging the PR created by this action, if applicable

Changelog entry

Add merge-trunk-develop-pr action

@tomalec tomalec force-pushed the add/merge-trunk-develop-pr branch 2 times, most recently from 0a8e3cc to 6a17d2c Compare August 2, 2023 22:20
to create a PR to merge `trunk` to `develop` after a release done by `woocommerce/grow/prepare-extension-release`.
As automerging with `automerge-released-trunk` may not work with branch protections.
@tomalec tomalec marked this pull request as ready for review August 2, 2023 22:35
@tomalec tomalec requested a review from a team August 2, 2023 22:36
Copy link
Member

@eason9487 eason9487 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work. LGTM.

This new GH action could be added to this list as well. (Maybe also add automerge-released-trunk action by the way?)

All my comments are not blocking this PR.

Comment on lines 7 to 15
- name: Checkout
uses: actions/checkout@v3
- name: "Set up git config"
shell: bash
# Use the github-actions bot account to commit.
# https://api.github.com/users/github-actions%5Bbot%5D
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not pretty sure but maybe these two steps are not necessary because the next step doesn't require any repo files nor operates with git commit. Perhaps it's worth trying to see if this action still works without them or at least the second one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :) I thought GHA needed an explicit username to create PRs.
But Github API calls works out of the box, away from CLI git https://github.com/tomalec/grow/actions/runs/5787573264?pr=30 :)

Removed in 161b44a

tomalec added a commit that referenced this pull request Aug 7, 2023
tomalec added a commit that referenced this pull request Aug 7, 2023
tomalec added a commit that referenced this pull request Aug 7, 2023
tomalec added a commit that referenced this pull request Aug 7, 2023
Github API calls does not need local repo.

Addresses #71 (comment)
@tomalec
Copy link
Member Author

tomalec commented Aug 7, 2023

Thank you for the review, and great suggestions. Applied them all.

@tomalec tomalec merged commit a29bf23 into trunk Aug 7, 2023
3 checks passed
@tomalec tomalec deleted the add/merge-trunk-develop-pr branch August 7, 2023 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants