Skip to content

Commit

Permalink
docs: update information about inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
tsinis committed Mar 30, 2024
1 parent 166d3d0 commit 25651f3
Show file tree
Hide file tree
Showing 4 changed files with 291 additions and 18 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/self_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Self Test
on: [pull_request]

jobs:
self-action-test:
name: This GitHub Action Test
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Test Local Action
if: github.actor == 'tsinis' || github.actor == 'dependabot[bot]'
uses: ./
with:
add-label: true
case-sensitive: true
fallback-to-ask: true
require-brackets: true
review-message: "Auto approved Ship or Ask PRs (from Dependabot/Author)"
43 changes: 35 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Auto Approve GitHub Action
# Ship/Show/Ask GitHub Action

[![CI](https://github.com/tsinis/ship-show-ask/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/tsinis/ship-show-ask/actions/workflows/ci.yml)

Expand All @@ -8,7 +8,7 @@ This is a fork of the [Auto Approve](https://github.com/marketplace/actions/auto

## Usage instructions

Create a workflow file (e.g. `.github/workflows/auto-approve.yml`) that contains a step that `uses: tsinis/[email protected]`. Here's an example workflow file:
Create a workflow file (e.g. `.github/workflows/ship-show-ask.yml`) that contains a step that `uses: tsinis/[email protected]`. Here's an example workflow file:

```yaml
name: Auto approve Ship/Show PRs
Expand All @@ -21,16 +21,43 @@ jobs:
pull-requests: write
steps:
- uses: tsinis/[email protected]
with:
ship-keyword: 'lgtm' # optional, default to 'ship'
show-keyword: 'lgty' # optional, default to 'show'
ask-keyword: 'check' # optional, default to 'ask'
case-sensitive: true # optional, default to false
add-label: false # optional, default to true
require-brackets: false # optional, default to true
fallback-to-ask: true # optional, default to false
```
Combine with an `if` clause to only auto-approve certain users. For example, to auto-approve [Dependabot][dependabot] pull requests, use:
In this example, the action is configured to recognize 'lgtm', 'lgty', and 'check' as the keywords for the respective strategies. The keywords are case-sensitive, a label will not be added to the pull request based on the strategy, the keywords doesn't require brackets, and if no keyword is detected, the action will fallback to the Ask strategy.
You can customize these options by changing the values in the `with` block.

> [!TIP]
> All of these inputs are optional, and if not provided, the action will use the default values.

### Inputs

- `ship-keyword`: The keyword for the Ship strategy. Default is 'ship'.
- `show-keyword`: The keyword for the Show strategy. Default is 'show'.
- `ask-keyword`: The keyword for the Ask strategy. Default is 'ask'.
- `case-sensitive`: Whether the keywords are case-sensitive. Default is 'false'.
- `add-label`: Whether to add a label to the pull request based on the strategy. Default is 'true'.
- `require-brackets`: Whether the keywords require brackets. Default is 'true'.
- `fallback-to-ask`: Whether to fallback to the Ask strategy if no keyword is detected. Default is 'false'.

### Other examples

You can combine action with an `if` clause to only ship-show-ask certain users. For example, to ship-show-ask [Dependabot][dependabot] pull requests, use:

```yaml
name: Ship/Show Dependabot PRs
on: pull_request_target
jobs:
auto-approve:
ship-show-ask:
runs-on: ubuntu-latest
permissions:
pull-requests: write
Expand All @@ -48,11 +75,11 @@ on:
workflow_dispatch:
inputs:
pullRequestNumber:
description: Pull request number to auto-approve
description: Pull request number for ship-show-ask
required: false
jobs:
auto-approve:
ship-show-ask:
runs-on: ubuntu-latest
permissions:
pull-requests: write
Expand All @@ -69,7 +96,7 @@ name: Ship/Show Dependabot PRs with a message
on: pull_request_target
jobs:
auto-approve:
ship-show-ask:
runs-on: ubuntu-latest
permissions:
pull-requests: write
Expand All @@ -91,7 +118,7 @@ name: Auto approve Ship/Show PRs
on: pull_request_target
jobs:
auto-approve:
ship-show-ask:
runs-on: ubuntu-latest
steps:
- uses: tsinis/[email protected]
Expand Down
33 changes: 29 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Ship/Show/Ask'
description: 'GitHub Action for a Ship, Show, Ask branching strategy'
branding:
icon: 'anchor'
color: 'green'
color: 'orange'
inputs:
github-token:
default: ${{ github.token }}
Expand All @@ -11,9 +11,34 @@ inputs:
pull-request-number:
description: '(optional) The ID of a pull request to auto-approve. By default, this action tries to use the pull_request event payload.'
required: false
review-message:
description: '(optional) The message of the pull request review.'
ship-keyword:
description: '(optional) The keyword for the Ship strategy, default to "ship".'
default: 'ship'
required: false
show-keyword:
description: '(optional) The keyword for the Show strategy, default to "show".'
default: 'show'
required: false
ask-keyword:
description: '(optional) The keyword for the Ask strategy, default to "ask".'
default: 'ask'
required: false
case-sensitive:
description: '(optional) Whether the keywords are case-sensitive, default to false.'
default: 'false'
required: false
add-label:
description: '(optional) Whether to add a label to the pull request based on the strategy, default to true.'
default: 'true'
required: false
require-brackets:
description: '(optional) Whether the keywords require brackets, default to true.'
default: 'true'
required: false
fallback-to-ask:
description: '(optional) Whether to fallback to the Ask strategy if no keyword is detected, default to false.'
default: 'false'
required: false
runs:
using: 'node20'
main: 'dist/index.js'
main: 'dist/index.js'
Loading

0 comments on commit 25651f3

Please sign in to comment.