Skip to content

Commit 5b9bf6d

Browse files
committed
ci: Update chatops action to v2
1 parent fbb6010 commit 5b9bf6d

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

.github/workflows/chatops.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@ jobs:
88
if: startsWith(github.event.comment.body, '/')
99
steps:
1010
- name: /command dispatch
11-
uses: peter-evans/slash-command-dispatch@v1
11+
uses: peter-evans/slash-command-dispatch@v2
1212
with:
1313
token: ${{ secrets.SLASH_COMMAND_DISPATCH_TOKEN }}
1414
reaction-token: ${{ github.token }}
1515
config: >
1616
[
1717
{
1818
"command": "tag",
19-
"permission": "admin",
20-
"named_args": true
19+
"permission": "admin"
2120
},
2221
{
2322
"command": "demo",
24-
"permission": "read"
23+
"permission": "none"
2524
}
2625
]

.github/workflows/tag-command.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,24 @@ on:
99
jobs:
1010
tag:
1111
runs-on: ubuntu-latest
12+
env:
13+
tag_name: ${{ github.event.client_payload.slash_command.unnamed.arg1 }}
1214
steps:
1315
- name: Add run link to command comment
1416
uses: peter-evans/create-or-update-comment@v1
1517
with:
1618
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
17-
body: '[Workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})'
19+
body: "[Workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"
1820
- uses: actions/checkout@v2
1921
with:
20-
ref: ${{ github.event.client_payload.slash_command.ref }}
22+
ref: ${{ github.event.client_payload.slash_command.named.ref }}
2123
- name: Resolve version, tag and push
2224
uses: ./
2325
with:
2426
script: |
25-
$args = $github.event.client_payload.slash_command.args -split ' '
26-
$force = $args -contains 'force' ? '--force' : ''
27-
$tag = $github.event.client_payload.slash_command.arg1
27+
$args = $github.event.client_payload.slash_command.unnamed
28+
$force = ($args.GetEnumerator() | ? Value -eq 'force') ? '--force' : ''
29+
$tag = $env:tag_name
2830
if (-not $tag) {
2931
throw "Can't create empty-named tag. Please specify tag after command: /tag vX.Y.Z"
3032
}
@@ -41,13 +43,13 @@ jobs:
4143
with:
4244
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
4345
body: |
44-
Pushed tag [`${{ github.event.client_payload.slash_command.arg1 }}`][tag]
46+
Pushed tag [`${{ env.tag_name }}`][tag]
4547
46-
[tag]: https://github.com/${{ github.repository }}/tree/${{ github.event.client_payload.slash_command.arg1 }}
48+
[tag]: https://github.com/${{ github.repository }}/tree/${{ env.tag_name }}
4749
reactions: hooray
4850
- name: Add reaction to command comment on failure
4951
uses: peter-evans/create-or-update-comment@v1
5052
if: failure()
5153
with:
5254
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
53-
reactions: "-1"
55+
reactions: "-1"

0 commit comments

Comments
 (0)