Skip to content

Commit

Permalink
Merge pull request #64 from woocommerce/add/automerge-action
Browse files Browse the repository at this point in the history
  • Loading branch information
tomalec authored Jul 24, 2023
2 parents 4ab95d2 + 81025fc commit 9474263
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/github-actions/actions/automerge-released-trunk/README.md
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
```
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

0 comments on commit 9474263

Please sign in to comment.