Skip to content

Commit

Permalink
fix: Skip commit message check if token not provided (#51)
Browse files Browse the repository at this point in the history
* Skip commit message check if token not provided

* Add doc
  • Loading branch information
jsirianni authored Nov 21, 2024
1 parent d03bb03 commit 0c4b471
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ BindPlane requires a license. You can request a free license [here](https://obse
| enable_otel_config_write_back | `false` | Whether or not the action should write the raw OpenTelemetry configurations back to the repository. |
| configuration_output_dir | | When write back is enabled, this is the path that will be written to. |
| configuration_output_branch | | The branch to write the OTEL configuration resources to. If unset, target_branch will be used. |
| token | | The Github token that will be used to write to the repo. Usually secrets.GITHUB_TOKEN is sufficient. Requires the `contents.write` permission. Alternatively, you can set `github_url`, which should contain your access token. |
| token | | The Github token that will be used to read and write to the repo. Usually secrets.GITHUB_TOKEN is sufficient. Requires the `contents.write` permission. Alternatively, you can set `github_url`, which should contain your access token. |
| enable_auto_rollout | `false` | When enabled, the action will trigger a rollout for any configuration that has been updated. |
| tls_ca_cert | | The contents of a TLS certificate authority, usually from a secret. See the [TLS](#tls) section. |
| github_url | | Optional URL to use when cloning the repository. Should be of the form `"https://{GITHUB_ACTOR}:{TOKEN}@{GITHUB_HOST}/{GITHUB_REPOSITORY}.git`. When set, `token` will not be used. |
Expand Down
30 changes: 17 additions & 13 deletions cmd/action/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,26 @@ func main() {
zap.Any("bindplane_version", version.Tag),
)

// Retrieve the commit message from the head commit on the branch
message, err := commitMessage(github_url, branch, token)
if err != nil {
logger.Error("error getting commit message", zap.Error(err))
os.Exit(exitClientError)
}

// If the commit message contains `progress rollout <name>`, progress the rollout
// for the configuration instead of running the full workflow.
if name, ok := extractConfigName(message); ok {
err := action.RunRollout(name)
if token != "" {
// Retrieve the commit message from the head commit on the branch
message, err := commitMessage(github_url, branch, token)
if err != nil {
logger.Error("error progressing rollout", zap.Error(err))
logger.Error("error getting commit message", zap.Error(err))
os.Exit(exitClientError)
}
return

// If the commit message contains `progress rollout <name>`, progress the rollout
// for the configuration instead of running the full workflow.
if name, ok := extractConfigName(message); ok {
err := action.RunRollout(name)
if err != nil {
logger.Error("error progressing rollout", zap.Error(err))
os.Exit(exitClientError)
}
return
}
} else {
logger.Info("Skipping commit message check, Github token not provided")
}

// Run the full workflow
Expand Down

0 comments on commit 0c4b471

Please sign in to comment.