Skip to content

skip-comment is inverted: default false skips the PR comment #250

Description

@Pomar81

Summary

The skip-comment input is inverted in main.go. With the documented default (false), the action does not post a PR comment. Setting skip-comment: true is what actually calls postGithubComment.

This matches action.yml:

Skip commenting on PR. If set to true, the action will not comment on the PR, but will still set outputs.

Default is false, so comments should be posted.

Reproduction

  1. Use launchdarkly/find-code-references-in-pull-request@v2 (observed SHA 3d0cb58224bc446bd9fe84faab3a1c4d8134cf76).
  2. Do not set skip-comment (defaults to false), or set skip-comment: false.
  3. Open a PR that adds a flag key present in the LaunchDarkly project.

Expected: A "LaunchDarkly flag references" comment on the PR.

Actual: Job succeeds, flags are found, then the log says:

Processing comment...
Skipping comment creation as skip-comment is set to true

The GITHUB_TOKEN in our run had PullRequests: write and Issues: write. No CreateComment / EditComment call was made.

Cause

if !config.SkipComment {
  gha.Log("Skipping comment creation as skip-comment is set to true")
} else {
  err = postGithubComment(ctx, flagsRef, config, existingComment, *event.PullRequest.Number, comment)
}

When SkipComment is false (default), !config.SkipComment is true, so the skip path runs.

Config parsing itself looks correct (strconv.ParseBool on INPUT_SKIP-COMMENT in config/config.go).

Suggested fix

if config.SkipComment {
  gha.Log("Skipping comment creation as skip-comment is set to true")
} else {
  err = postGithubComment(ctx, flagsRef, config, existingComment, *event.PullRequest.Number, comment)
}

Please publish a @v2 tag that includes the fix. The current inversion means every consumer on the default config silently loses PR comments.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions