feat: manage delete modes in a better way + consistent input naming #441
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: pull_request | |
jobs: | |
test_comment_pr: | |
name: (NRT) Comment PR | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: (BEFORE) Setup test cases | |
run: echo '**Content of file referenced with absolute path**' > /tmp/foobar.txt | |
- name: Comment PR with message | |
uses: ./ | |
id: nrt-message | |
with: | |
message: | | |
Current branch is `${{ github.head_ref }}`. | |
_(execution **${{ github.run_id }}** / attempt **${{ github.run_attempt }}**)_ | |
comment-tag: nrt-message | |
reactions: eyes, rocket | |
mode: recreate | |
- name: Create a comment to delete it after | |
uses: ./ | |
with: | |
message: | | |
This message will be deleted | |
comment-tag: nrt-message-delete | |
reactions: eyes | |
- name: Delete comment | |
uses: ./ | |
with: | |
comment-tag: nrt-message-delete | |
mode: delete | |
- name: Comment PR with message that will be deleted | |
uses: ./ | |
with: | |
message: | | |
This PR is being built... | |
comment-tag: nrt-message-delete-on-completion | |
reactions: eyes | |
mode: delete-on-completion | |
- name: Comment PR with file | |
uses: ./ | |
with: | |
file-path: README.md | |
comment-tag: nrt-file | |
reactions: eyes, rocket | |
mode: recreate | |
- name: Comment PR with file (absolute path) | |
uses: ./ | |
with: | |
file-path: /tmp/foobar.txt | |
comment-tag: nrt-file-absolute | |
reactions: eyes, rocket | |
mode: recreate | |
- name: Do not comment PR if not exists | |
uses: ./ | |
with: | |
message: Should not be printed | |
comment-tag: nrt-create-if-not-exists | |
create-if-not-exists: false | |
- name: Check outputs | |
run: | | |
echo "id : ${{ steps.nrt-message.outputs.id }}" | |
echo "body : ${{ steps.nrt-message.outputs.body }}" | |
echo "html-url : ${{ steps.nrt-message.outputs.html-url }}" | |
- name: (AFTER) Setup test cases | |
run: rm /tmp/foobar.txt |