Skip to content

Commit

Permalink
docs: using token and multiple branch merge
Browse files Browse the repository at this point in the history
  • Loading branch information
lcenchew committed Aug 23, 2020
1 parent 16b9d7e commit f319e34
Showing 1 changed file with 63 additions and 30 deletions.
93 changes: 63 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,21 @@ Current limitations:
- only work with public upstream Github repository
- merge fast forward only (--ff-only)

## Usage

### Set up for manual trigger
copy and commit this to `.github/workflows/merge-upstream.yml` in your default branch of your repository.
To merge multiple branches, create multiple jobs.

To run action for another repository, create a [personal access token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)
```yaml
name: Manual Merge Remote Action
on:
workflow_dispatch:
inputs:
upstream:
description: 'Upstream repository owner/name. Eg. exions/merge-upstream'
required: true
default: 'owner/name' # set the upstream repo
upstream:
description: 'Upstream branch to merge from. Eg. master'
required: true
default: 'master' # set the upstream branch to merge from
branch:
description: 'Branch to merge to'
required: true
default: 'upstream' # set the branch to merge to

jobs:
merge-upstream:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.branch }}
fetch-depth: 0
- name: Merge Upstream
uses: exions/merge-upstream@v1
with:
upstream: ${{ github.event.inputs.upstream }}
upstream-branch: ${{ github.event.inputs.upstream-branch }}
branch: ${{ github.event.inputs.branch }}
token: ${{ secrets.TOKEN }}
```
## Usage
### Set up for scheduled trigger
```yaml
Expand All @@ -70,8 +45,27 @@ jobs:
upstream: owner/repo # set the upstream repo
upstream-branch: master # set the upstream branch to merge from
branch: upstream # set the branch to merge to

# set up another job to merge another branch
merge-upstream-another-branch:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: another-branch # set the branch to merge to
fetch-depth: 0
- name: Merge Upstream
uses: exions/merge-upstream@v1
with:
upstream: owner/repo # set the upstream repo
upstream-branch: another-branch # set the upstream branch to merge from
branch: another-branch # set the branch to merge to

```



Reference:
- [Triggering a workflow with events](https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#triggering-a-workflow-with-events)
- [Creating a composite run steps action](https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action)
Expand All @@ -86,3 +80,42 @@ This action can trigger manually as needed.
4. Fill in the upstream repository and branch to merge from, and the branch to merge to (⚠️ double check all are correct)
5. Click `Run workflow`
6. Check your branch commit history

### Set up for manual trigger
copy and commit this to `.github/workflows/merge-upstream.yml` in your default branch of your repository.

```yaml
name: Manual Merge Remote Action
on:
workflow_dispatch:
inputs:
upstream:
description: 'Upstream repository owner/name. Eg. exions/merge-upstream'
required: true
default: 'owner/name' # set the upstream repo
upstream:
description: 'Upstream branch to merge from. Eg. master'
required: true
default: 'master' # set the upstream branch to merge from
branch:
description: 'Branch to merge to'
required: true
default: 'upstream' # set the branch to merge to

jobs:
merge-upstream:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.branch }}
fetch-depth: 0
- name: Merge Upstream
uses: exions/merge-upstream@v1
with:
upstream: ${{ github.event.inputs.upstream }}
upstream-branch: ${{ github.event.inputs.upstream-branch }}
branch: ${{ github.event.inputs.branch }}
token: ${{ secrets.TOKEN }}
```

0 comments on commit f319e34

Please sign in to comment.