Skip to content

Commit

Permalink
Add an on-update parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael Schloming committed Jun 2, 2022
1 parent dea9f04 commit ac9e347
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ inputs:
prefix:
description: comment prefix
required: true
on-update:
description: control behavior on update can be append or replace (default append)
required: false
default: append
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.path }}
- ${{ inputs.prefix }}
- ${{ inputs.prefix }}
- ${{ inputs.replace }}
11 changes: 10 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ else
end
file_path = ARGV[0]
prefix = ARGV[1]
on_update = ARGV[2]

puts Dir.entries(".")

Expand All @@ -48,5 +49,13 @@ if com == nil
github.add_comment(repo, pr_number, prefix + "\n\n" + message)
else
cur_time = Time.new
com = github.update_comment(repo, com["id"], com["body"] + "\n\nUpdate on " + cur_time.inspect + "\n\n" + message)
timestamp = "\n\nUpdate on " + cur_time.inspect + "\n\n"

if on_update == "replace"
body = prefix + timestamp + message
else
body = com["body"] + timestamp + message
end

com = github.update_comment(repo, com["id"], body)
end

0 comments on commit ac9e347

Please sign in to comment.