Skip to content

Commit

Permalink
optional placeholder comment
Browse files Browse the repository at this point in the history
fix accessToken

fail if error getting flags
  • Loading branch information
Dan O'Brien committed Apr 12, 2021
1 parent ac9d8c6 commit a809763
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ runs:
LD_BASE_URI: ${{ inputs.baseUri }}
LD_ENV_KEY: ${{ inputs.envKey }}
GITHUB_TOKEN: ${{ inputs.githubToken }}
PLACEHOLDER_COMMENT: $${{ inputs.placeholderComment }}
inputs:
projKey:
description: 'LaunchDarkly Project'
Expand All @@ -26,3 +27,10 @@ inputs:
githubToken:
description: 'Token to access your GitHub repository.'
required: true
accessToken:
description: 'LaunchDarkly access token'
required: true
placeholderComment:
description: 'Comment even if no flags are found. If flags are found in later commits this comment will be updated.'
required: true
default: 'true'
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func main() {
flags, _, err := ldClient.ld.FeatureFlagsApi.GetFeatureFlags(ldClient.ctx, ldProject, &flagOpts)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
flagKeys := make([]string, 0, len(flags.Items))

Expand Down Expand Up @@ -264,7 +265,7 @@ func main() {
if err != nil {
fmt.Println(err)
}
} else if len(flagsAdded) == 0 && len(flagsRemoved) == 0 {
} else if len(flagsAdded) == 0 && len(flagsRemoved) == 0 && os.Getenv("PLACEHOLDER_COMMENT") == "true" {
// Check if this is already the body, flags could have originally been included then removed in later commit
if strings.Contains(existingCommentBody, "No flag references found in PR") {
return
Expand Down

0 comments on commit a809763

Please sign in to comment.