Skip to content

Commit b586717

Browse files
authored
Merge pull request #3 from tsinis/v0.1.1
feat: added review-message input parameter [show]
2 parents ae39474 + e5bf3bb commit b586717

File tree

3 files changed

+30
-15
lines changed

3 files changed

+30
-15
lines changed

README.md

+24-12
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,25 @@
44

55
**Name:** `tsinis/ship-show-ask`
66

7-
This is a fork of the [Auto Approve](https://github.com/marketplace/actions/auto-approve) GitHub Action adjusted for a Ship, Show, Ask branching strategy.
7+
This action will get information about the preferred ship/show/ask strategy of the pull request from its title (by searching for keywords in the title). This is a fork of the [Auto Approve](https://github.com/marketplace/actions/auto-approve) GitHub Action adjusted for a Ship, Show, Ask branching strategy.
88

99
## Usage instructions
1010

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

1313
```yaml
1414
name: Auto approve Ship/Show PRs
15-
on: pull_request_target
15+
on:
16+
pull_request:
17+
types: [opened, synchronize, reopened, edited]
1618

1719
jobs:
18-
build:
20+
ship-show-ask:
1921
runs-on: ubuntu-latest
2022
permissions:
2123
pull-requests: write
2224
steps:
23-
- uses: tsinis/[email protected].0
25+
- uses: tsinis/[email protected].1
2426
with:
2527
ship-keyword: 'lgtm' # optional, default to 'ship'
2628
show-keyword: 'lgty' # optional, default to 'show'
@@ -29,6 +31,9 @@ jobs:
2931
add-label: false # optional, default to true
3032
require-brackets: false # optional, default to true
3133
fallback-to-ask: true # optional, default to false
34+
review-message: "Auto approved PR!" # optional message to use in approved pull request.
35+
# github-token: ${{ secrets.SOME_USERS_PAT }} # optional GITHUB_TOKEN secret, default to ${{ github.token }}
36+
# pull-request-number: 1 # optional ID of a pull request to approve. By default, this action tries to use the pull_request event payload.
3237
```
3338

3439
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.
@@ -47,6 +52,9 @@ You can customize these options by changing the values in the `with` block.
4752
- `add-label`: Whether to add a label to the pull request based on the strategy. Default is 'true'.
4853
- `require-brackets`: Whether the keywords require brackets. Default is 'true'.
4954
- `fallback-to-ask`: Whether to fallback to the Ask strategy if no keyword is detected. Default is 'false'.
55+
- `review-message`: Message to use on PR approval.
56+
- `github-token`: GITHUB_TOKEN secret, default to ${{ github.token }}
57+
- `pull-request-number`: id of a pull request to approve. By default, this action tries to use the pull_request event payload.
5058

5159
### Other examples
5260

@@ -63,7 +71,7 @@ jobs:
6371
pull-requests: write
6472
if: github.actor == 'dependabot[bot]'
6573
steps:
66-
- uses: tsinis/[email protected].0
74+
- uses: tsinis/[email protected].1
6775
```
6876
6977
If you want to use this action from a workflow file that doesn't run on the `pull_request` or `pull_request_target` events, use the `pull-request-number` input:
@@ -84,7 +92,7 @@ jobs:
8492
permissions:
8593
pull-requests: write
8694
steps:
87-
- uses: tsinis/[email protected].0
95+
- uses: tsinis/[email protected].1
8896
with:
8997
pull-request-number: ${{ github.event.inputs.pullRequestNumber }}
9098
```
@@ -93,7 +101,9 @@ Optionally, you can provide a message for the review:
93101

94102
```yaml
95103
name: Ship/Show Dependabot PRs with a message
96-
on: pull_request_target
104+
on:
105+
pull_request:
106+
types: [opened, synchronize, reopened, edited]
97107
98108
jobs:
99109
ship-show-ask:
@@ -102,7 +112,7 @@ jobs:
102112
pull-requests: write
103113
if: github.actor == 'dependabot[bot]'
104114
steps:
105-
- uses: tsinis/[email protected].0
115+
- uses: tsinis/[email protected].1
106116
with:
107117
review-message: "Auto approved automated PR (from Dependabot)"
108118
```
@@ -115,13 +125,15 @@ To approve the pull request as a different user, pass a GitHub Personal Access T
115125

116126
```yaml
117127
name: Auto approve Ship/Show PRs
118-
on: pull_request_target
128+
on:
129+
pull_request:
130+
types: [opened, synchronize, reopened, edited]
119131
120132
jobs:
121133
ship-show-ask:
122134
runs-on: ubuntu-latest
123135
steps:
124-
- uses: tsinis/[email protected].0
136+
- uses: tsinis/[email protected].1
125137
with:
126138
github-token: ${{ secrets.SOME_USERS_PAT }}
127139
```
@@ -144,4 +156,4 @@ If you're using a [CODEOWNERS file](https://docs.github.com/en/github/creating-c
144156

145157
## Development and release process
146158

147-
Each major version corresponds to a branch (e.g. `v0.1`, `v1.0`). Releases are tagged with semver-style version numbers (e.g. `v1.2.3`).
159+
Each major version corresponds to a branch (e.g. `v0.1`, `v1.0`). Releases are tagged with semver-style version numbers (e.g. `v0.1.2`).

action.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Ship/Show/Ask'
2-
description: 'GitHub Action for a Ship, Show, Ask branching strategy'
2+
description: 'GitHub Action for a Ship, Show, Ask branching strategy from PR title'
33
branding:
44
icon: 'anchor'
55
color: 'orange'
@@ -11,6 +11,9 @@ inputs:
1111
pull-request-number:
1212
description: '(optional) The ID of a pull request to auto-approve. By default, this action tries to use the pull_request event payload.'
1313
required: false
14+
review-message:
15+
description: '(optional) The message of the pull request review.'
16+
required: false
1417
ship-keyword:
1518
description: '(optional) The keyword for the Ship strategy, default to "ship".'
1619
default: 'ship'

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ship-show-ask",
3-
"version": "0.1.0",
4-
"description": "GitHub Action for a Ship, Show, Ask branching strategy",
3+
"version": "0.1.1",
4+
"description": "GitHub Action for a Ship, Show, Ask branching strategy from PR title",
55
"main": "dist/main.ts",
66
"scripts": {
77
"build": "ncc build src/main.ts",

0 commit comments

Comments
 (0)