2020-04-17 15:05:53 +09:00
|
|
|
name: Test Command
|
|
|
|
on:
|
|
|
|
repository_dispatch:
|
|
|
|
types: [test-command]
|
|
|
|
jobs:
|
|
|
|
testCreateOrUpdateComment:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
# Get the target repository and branch
|
|
|
|
- name: Get the target repository and branch
|
|
|
|
id: vars
|
|
|
|
run: |
|
|
|
|
repository=${{ github.event.client_payload.slash_command.repository }}
|
|
|
|
if [[ -z "$repository" ]]; then repository=${{ github.repository }}; fi
|
2022-10-18 16:56:13 +09:00
|
|
|
echo "repository=$repository" >> $GITHUB_OUTPUT
|
2020-04-17 15:05:53 +09:00
|
|
|
branch=${{ github.event.client_payload.slash_command.branch }}
|
2021-05-12 17:18:15 +09:00
|
|
|
if [[ -z "$branch" ]]; then branch="main"; fi
|
2022-10-18 16:56:13 +09:00
|
|
|
echo "branch=$branch" >> $GITHUB_OUTPUT
|
2020-04-17 15:05:53 +09:00
|
|
|
|
|
|
|
# Checkout the branch to test
|
2023-09-06 05:47:37 +00:00
|
|
|
- uses: actions/checkout@v4
|
2020-04-17 15:05:53 +09:00
|
|
|
with:
|
|
|
|
repository: ${{ steps.vars.outputs.repository }}
|
|
|
|
ref: ${{ steps.vars.outputs.branch }}
|
|
|
|
|
|
|
|
# Test create
|
|
|
|
- name: Create comment
|
|
|
|
uses: ./
|
|
|
|
id: couc
|
|
|
|
with:
|
|
|
|
issue-number: 1
|
|
|
|
body: |
|
|
|
|
This is a multi-line test comment
|
2020-06-08 08:38:27 +09:00
|
|
|
- With GitHub **Markdown** :sparkles:
|
2020-04-17 15:05:53 +09:00
|
|
|
- Created by [create-or-update-comment][1]
|
|
|
|
|
|
|
|
[1]: https://github.com/peter-evans/create-or-update-comment
|
2020-04-17 16:47:21 +09:00
|
|
|
reactions: '+1'
|
2020-04-17 15:05:53 +09:00
|
|
|
|
|
|
|
# Test update
|
|
|
|
- name: Update comment
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
comment-id: ${{ steps.couc.outputs.comment-id }}
|
|
|
|
body: |
|
|
|
|
**Edit:** Some additional info
|
2020-04-17 16:47:21 +09:00
|
|
|
reactions: eyes
|
2023-04-05 16:14:13 +09:00
|
|
|
reactions-edit-mode: replace
|
2020-04-17 15:05:53 +09:00
|
|
|
|
2020-04-17 16:47:21 +09:00
|
|
|
# Test add reactions
|
|
|
|
- name: Add reactions
|
2020-04-17 15:05:53 +09:00
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
comment-id: ${{ steps.couc.outputs.comment-id }}
|
2020-04-17 16:23:26 +09:00
|
|
|
reactions: heart, hooray, laugh
|
2020-04-17 15:05:53 +09:00
|
|
|
|
2022-10-21 12:34:03 +09:00
|
|
|
# Test create with body from file
|
|
|
|
- name: Create comment
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
issue-number: 1
|
2023-04-05 16:14:13 +09:00
|
|
|
body-path: .github/comment-body.md
|
2022-10-21 12:34:03 +09:00
|
|
|
|
|
|
|
# Test create from template
|
2021-04-09 14:31:37 +09:00
|
|
|
- name: Render template
|
|
|
|
id: template
|
2023-12-13 05:32:07 +00:00
|
|
|
uses: chuhlomin/render-template@v1.9
|
2021-04-09 14:31:37 +09:00
|
|
|
with:
|
|
|
|
template: .github/comment-template.md
|
|
|
|
vars: |
|
|
|
|
foo: this
|
|
|
|
bar: that
|
|
|
|
|
|
|
|
- name: Create comment
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
issue-number: 1
|
|
|
|
body: ${{ steps.template.outputs.result }}
|
2023-04-05 16:14:13 +09:00
|
|
|
|
|
|
|
- name: Add reaction
|
2023-04-12 05:58:31 +00:00
|
|
|
uses: peter-evans/create-or-update-comment@v3
|
2023-04-05 16:14:13 +09:00
|
|
|
with:
|
|
|
|
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
|
|
|
|
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
|
|
|
|
reactions: hooray
|