-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from woocommerce/add/automerge-action
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
packages/github-actions/actions/automerge-released-trunk/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Auto merge a released trunk | ||
|
||
This action provides the following functionality for GitHub Actions users: | ||
|
||
- Automatically merge trunk to develop after a release done with the `woocommerce/grow/prepare-extension-release` | ||
|
||
## Usage | ||
|
||
See [action.yml](action.yml) | ||
|
||
#### Basic: | ||
|
||
```yaml | ||
name: Auto merge a released trunk | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
branches: | ||
- trunk | ||
|
||
jobs: | ||
automerge_trunk: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: woocommerce/grow/automerge-released-trunk@actions-v1 | ||
``` |
20 changes: 20 additions & 0 deletions
20
packages/github-actions/actions/automerge-released-trunk/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Auto merge a released trunk | ||
description: Automatically merge trunk to develop after a release. | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: "Merge the release to develop" | ||
shell: bash | ||
if: ${{ github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') && github.event.pull_request.user.login == 'github-actions[bot]' }} | ||
# 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 | ||
git fetch origin develop trunk --unshallow --no-tags | ||
git checkout develop | ||
git merge --no-ff origin/trunk -m "Automerge ${{ github.head_ref }} from trunk to develop" | ||
git push |