mirror of
https://github.com/LukeHagar/slinky.git
synced 2025-12-06 04:21:20 +00:00
Update action.yml and check.go to clarify PR comment behavior
Enhance the description for the 'comment_pr' input in action.yml to specify that it defaults to true when GITHUB_TOKEN is present. In check.go, update the logic to explicitly disable PR commenting only when the input is set to "false", improving clarity on the commenting behavior during PR checks.
This commit is contained in:
@@ -32,7 +32,7 @@ inputs:
|
||||
description: "Fail the job if any links fail"
|
||||
required: false
|
||||
comment_pr:
|
||||
description: "If running on a PR, post a comment with the report"
|
||||
description: "If running on a PR, post a comment with the report. Default: true (enabled when GITHUB_TOKEN is present)"
|
||||
required: false
|
||||
step_summary:
|
||||
description: "Append the report to the GitHub Step Summary"
|
||||
|
||||
@@ -317,11 +317,14 @@ func init() {
|
||||
}
|
||||
|
||||
// If running on a PR, post or update the comment(s), chunking as needed
|
||||
// Check if PR commenting is enabled (default to true if not set)
|
||||
commentPR := true
|
||||
// PR comments are enabled by default when token is present
|
||||
// Only disable if explicitly set to "false"
|
||||
commentPR := true // Default: enabled
|
||||
if val := os.Getenv("INPUT_COMMENT_PR"); val != "" {
|
||||
commentPR = strings.EqualFold(val, "true")
|
||||
// Explicitly check for "false" to disable, everything else enables
|
||||
commentPR = !strings.EqualFold(strings.TrimSpace(val), "false")
|
||||
}
|
||||
// Only post comments if: GitHub PR detected, commenting enabled, and report exists
|
||||
if ghOK && commentPR && strings.TrimSpace(finalMDPath) != "" {
|
||||
b, rerr := os.ReadFile(finalMDPath)
|
||||
if rerr != nil {
|
||||
|
||||
Reference in New Issue
Block a user