diff --git a/README.md b/README.md index d591677..a893db9 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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) @@ -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 }} +```