-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
48 lines (46 loc) · 1.47 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Save comment
description: Add new comment or update existing one
inputs:
text:
description: Text to place in comment
required: true
search_key:
description: Key to find existing comment
required: true
timezone:
description: Timzone for update timestamp
required: false
default: 'UTC'
runs:
using: composite
steps:
# Find
- name: Find comment by "${{ inputs.search_key }}"
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: ${{ inputs.search_key }}
# Create
- name: Post new comment
if: ${{ steps.find-comment.outputs.comment-id == 0 }}
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: ${{ inputs.text }}
# Update
- name: Get current date
if: ${{ steps.find-comment.outputs.comment-id != 0 }}
id: current-date
shell: bash
run: echo "date=$(TZ=":${{ inputs.timezone }}" date +'%Y-%m-%d %T %z')" >> $GITHUB_OUTPUT
- name: Update existing comment
if: ${{ steps.find-comment.outputs.comment-id != 0 }}
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: replace
body: |
${{ inputs.text }}
UPD: ${{ steps.current-date.outputs.date }}