create-or-update-comment/.github/workflows/test-command.yml

77 lines
2.3 KiB
YAML
Raw Normal View History

2020-04-17 14:05:53 +08: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
echo ::set-output name=repository::$repository
branch=${{ github.event.client_payload.slash_command.branch }}
2021-05-12 16:18:15 +08:00
if [[ -z "$branch" ]]; then branch="main"; fi
2020-04-17 14:05:53 +08:00
echo ::set-output name=branch::$branch
# Checkout the branch to test
- uses: actions/checkout@v2
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 07:38:27 +08:00
- With GitHub **Markdown** :sparkles:
2020-04-17 14:05:53 +08:00
- Created by [create-or-update-comment][1]
[1]: https://github.com/peter-evans/create-or-update-comment
2020-04-17 15:47:21 +08:00
reactions: '+1'
2020-04-17 14:05:53 +08:00
# Test update
- name: Update comment
uses: ./
with:
comment-id: ${{ steps.couc.outputs.comment-id }}
body: |
**Edit:** Some additional info
2020-04-17 15:47:21 +08:00
reactions: eyes
2020-04-17 14:05:53 +08:00
2020-04-17 15:47:21 +08:00
# Test add reactions
- name: Add reactions
2020-04-17 14:05:53 +08:00
uses: ./
with:
comment-id: ${{ steps.couc.outputs.comment-id }}
2020-04-17 15:23:26 +08:00
reactions: heart, hooray, laugh
2020-04-17 14:05:53 +08:00
- name: Add reaction
uses: peter-evans/create-or-update-comment@v1
with:
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
2020-04-17 15:47:21 +08:00
reactions: hooray
2021-04-09 13:31:37 +08:00
- name: Render template
id: template
uses: chuhlomin/render-template@v1.4
2021-04-09 13:31:37 +08: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 }}