Skip to content

Commit

Permalink
Provide step output (#186)
Browse files Browse the repository at this point in the history
* Provide step output

* Provide step output

Co-authored-by: Liri Sokol <liri@apiiro.com>
  • Loading branch information
pascalgn and liiri authored Mar 24, 2022
1 parent a0b6e74 commit d2882c7
Show file tree
Hide file tree
Showing 10 changed files with 877 additions and 117 deletions.
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ jobs:
automerge:
runs-on: ubuntu-latest
steps:
- name: automerge
- id: automerge
name: automerge
uses: "pascalgn/automerge-action@v0.14.3"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
Expand Down Expand Up @@ -203,6 +204,8 @@ Also, the following general options are supported:

- `PULL_REQUEST`: If provided, this action will attempt to merge the specified pull request. By default, it will attempt to use the pull request specified in the GitHub context. If a pull request number is provided via this input, this action will search in the current repo for the provided pull request number. If you want to merge a pull request in another repo, just provide the repo slug before the pull request number, like `Some-Org/Some-Repo/1234`

- `BASE_BRANCHES`: If provided, the action will be restricted in terms of base branches. Can be comma-separated list of simple branch names (i.e `main,dev`).

You can configure the environment variables in the workflow file like this:

```yaml
Expand Down Expand Up @@ -240,6 +243,34 @@ Automerge can be configured to run for these events:

For more information on when these occur, see the Github documentation on [events that trigger workflows](https://docs.github.com/en/actions/reference/events-that-trigger-workflows) and [their payloads](https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads).

## Outputs

The action will provide two [outputs](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idoutputs):

* `mergeResult` - The result from the action run, one of `skipped`, `not_ready`, `author_filtered`, `merge_failed`, `merged`
* `pullRequestNumber` - The pull request number (or `0`, if no pull request was affected)

Please note:

1. When there are multiple pull requests affected, only the first one will be available in the output
2. To access these outputs, your workflow configuration must define an `id` for the automerge-action step
3. Unless a personal access token is used, this action will not trigger other actions, see [Limitations](#limitations)

Example usage:

```yaml
steps:
- id: automerge
name: automerge
uses: "pascalgn/automerge-action@v0.14.3"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: feedback
if: steps.automerge.outputs.mergeResult == "merged"
run: |
echo "Pull request ${{ steps.automerge.outputs.pullRequestNumber }} merged!"
```

## Limitations

- When a pull request is merged by this action, the merge will not trigger other GitHub workflows.
Expand Down
12 changes: 12 additions & 0 deletions dist/LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
@actions/core
MIT
The MIT License (MIT)

Copyright 2019 GitHub

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@octokit/auth-token
MIT
The MIT License
Expand Down
Loading

0 comments on commit d2882c7

Please sign in to comment.