Skip to content

Commit d6637d1

Browse files
committed
First implementation
1 parent cfb9568 commit d6637d1

File tree

9 files changed

+10861
-0
lines changed

9 files changed

+10861
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
.idea/

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 castLabs GmbH
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Input Parameters Action
2+
3+
This action provides a uniform interface for job input parameters whether the
4+
job has been triggerered from a `workflow_dispatch` event or from a
5+
`pull_request_review_comment`event. In the latter case, input parameters must
6+
be provided JSON-formatted in the review comment body, after a configurable
7+
prefix.
8+
9+
The parameters are exposed as outputs, together with `valid-trigger` true/false
10+
string that will be true unless the job was triggered from a review comment that
11+
does not start with the configured prefix.
12+
13+
## Inputs
14+
15+
| Name | Description |
16+
|------------------|----------------------------------------------------------------|
17+
| `line-prefix` | A previx that will identify a comment as triggering a workflow |
18+
19+
20+
## Outputs
21+
22+
| Name | Description |
23+
|-----------------|-------------------------------|
24+
| `*` | The other input parameters |
25+
26+
## Example usage
27+
28+
```
29+
on:
30+
workflow_dispatch:
31+
inputs:
32+
clean-workspace:
33+
description: 'Cleans the workspace before git checkout'
34+
type: boolean
35+
required: false
36+
...
37+
- uses: castlabs/[email protected]
38+
id: parameters
39+
with:
40+
line-prefix: '/workflow'
41+
42+
- name: Clean workspace
43+
if: ${{ steps.parameters.outputs.clean-workspace == 'true' }}
44+
run: rm -rf *

action.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Extract input parameters from manual trigger or pull request body
2+
description: |
3+
This action provides a uniform interface for job input parameters whether the
4+
job has been triggerered from a `workflow_dispatch` event or from a
5+
`pull_request` event. In the latter case, input parameters must be provided
6+
JSON-formatted in the PR text, in a line starting with a configurable prefix.
7+
The parameters are exposed as outputs.
8+
9+
inputs:
10+
line-prefix:
11+
description: A prefix that will mark the PR text line containing inputs.
12+
required: false
13+
default: '/workflow'
14+
15+
runs:
16+
using: 'node16'
17+
main: 'dist/index.js'

dist/LICENSE

+635
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)