terramate-io / terramate

Terramate CLI is an open-source Infrastructure as Code (IaC) Orchestration and Code Generation tool for Terraform, OpenTofu and Terragrunt.
https://terramate.io
Mozilla Public License 2.0
3.12k stars 86 forks source link

chore: improve warn messages in case GITHUB_TOKEN is not exported. #1722

Closed i4ki closed 1 month ago

i4ki commented 1 month ago

What this PR does / why we need it:

Improves the error messages when synchronizing commands and GITHUB_TOKEN is not exported. Before it gave the error below:

2024-02-23T17:03:03Z WRN failed to retrieve commit information from GitHub API error="GET https://api.github.com/repos/terramate-io/terramate-quickstart-aws/commits/d74239b4e91562a2c12994cbd6de9b86680b1378: 404 Not Found []" github_repository=terramate-io/terramate-quickstart-aws head_commit=d74239b4e91562a2c12994cbd6de9b86680b1378 normalized_repository=github.com/terramate-io/terramate-quickstart-aws
2024-02-23T17:03:03Z WRN failed to retrieve pull requests associated with HEAD error="GET https://api.github.com/repos/terramate-io/terramate-quickstart-aws/commits/d74239b4e91562a2c12994cbd6de9b86680b1378/pulls?per_page=1: 404 Not Found []" github_repository=terramate-io/terramate-quickstart-aws head_commit=d74239b4e91562a2c12994cbd6de9b86680b1378 normalized_repository=github.com/terramate-io/terramate-quickstart-aws
Warning: unable to create preview
> invalid payload: missing "review_request" field
2024-02-23T17:03:03Z WRN disabling the cloud features error="unprocessable cloud feature"

but now it shows:

Screenshot 2024-05-21 at 18 00 05

In the case of a preview sync without pull request information, now it shows:

Screenshot 2024-05-21 at 18 25 07

Which issue(s) this PR fixes:

none

Special notes for your reviewer:

Does this PR introduce a user-facing change?

no
github-actions[bot] commented 1 month ago
metric: time/op
CloudReadLines-4: old 1.02ms ± 9%: new 1.03ms ± 4%: delta: 0.00%
CloudReadLine-4: old 7.13ms ± 1%: new 7.17ms ± 1%: delta: 0.62%
ListFiles-4: old 54.9µs ± 1%: new 54.8µs ± 1%: delta: 0.00%
Generate-4: old 2.73s ± 1%: new 2.71s ± 2%: delta: -0.87%
GenerateRegex-4: old 1.87s ± 1%: new 1.84s ± 2%: delta: -1.66%
TokensForExpressionComplex-4: old 1.27ms ± 1%: new 1.27ms ± 0%: delta: 0.00%
TokensForExpressionPlainStringNoNewline-4: old 821ns ± 0%: new 825ns ± 0%: delta: 0.56%
TokensForExpressionStringWith100Newlines-4: old 22.4µs ± 1%: new 22.5µs ± 1%: delta: 0.00%
TokensForExpressionObjectWith100KeysWithNumberValues-4: old 1.46ms ± 0%: new 1.47ms ± 1%: delta: 0.30%
TokensForExpression-4: old 1.28ms ± 0%: new 1.28ms ± 0%: delta: 0.21%
PartialEvalComplex-4: old 596µs ± 1%: new 593µs ± 1%: delta: -0.44%
PartialEvalSmallString-4: old 3.68µs ± 1%: new 3.69µs ± 1%: delta: 0.29%
PartialEvalHugeString-4: old 1.89ms ± 0%: new 1.90ms ± 0%: delta: 0.28%
PartialEvalHugeInterpolatedString-4: old 5.04ms ± 1%: new 5.07ms ± 1%: delta: 0.74%
PartialEvalObject-4: old 24.8µs ± 1%: new 25.0µs ± 1%: delta: 0.94%
TmAllTrueLiteralList-4: old 6.39ms ± 1%: new 6.40ms ± 1%: delta: 0.17%
TmAllTrueFuncall-4: old 165µs ± 0%: new 165µs ± 0%: delta: 0.20%
TmAnyTrueLiteralList-4: old 150ms ± 0%: new 151ms ± 0%: delta: 0.00%
TmAnyTrueFuncall-4: old 165µs ± 1%: new 166µs ± 1%: delta: 0.22%
TmTernary-4: old 2.90µs ± 1%: new 2.90µs ± 1%: delta: 0.31%
TmTry-4: old 53.2µs ± 1%: new 53.3µs ± 0%: delta: 0.16%
metric: alloc/op
CloudReadLines-4: old 3.12MB ± 0%: new 3.12MB ± 0%: delta: 0.00%
CloudReadLine-4: old 3.37MB ± 0%: new 3.37MB ± 0%: delta: 0.00%
ListFiles-4: old 22.0kB ± 0%: new 22.0kB ± 0%: delta: 0.00%
Generate-4: old 2.32GB ± 0%: new 2.32GB ± 0%: delta: 0.00%
GenerateRegex-4: old 956MB ± 0%: new 956MB ± 0%: delta: -0.02%
TokensForExpressionComplex-4: old 404kB ± 0%: new 404kB ± 0%: delta: 0.00%
TokensForExpressionPlainStringNoNewline-4: old 512B ± 0%: new 512B ± 0%: delta: 0.00%
TokensForExpressionStringWith100Newlines-4: old 12.4kB ± 0%: new 12.4kB ± 0%: delta: 0.00%
TokensForExpressionObjectWith100KeysWithNumberValues-4: old 394kB ± 0%: new 394kB ± 0%: delta: 0.00%
TokensForExpression-4: old 404kB ± 0%: new 404kB ± 0%: delta: 0.00%
PartialEvalComplex-4: old 408kB ± 0%: new 408kB ± 0%: delta: 0.00%
PartialEvalSmallString-4: old 1.74kB ± 0%: new 1.74kB ± 0%: delta: 0.00%
PartialEvalHugeString-4: old 166kB ± 0%: new 166kB ± 0%: delta: 0.00%
PartialEvalHugeInterpolatedString-4: old 4.38MB ± 0%: new 4.38MB ± 0%: delta: 0.00%
PartialEvalObject-4: old 21.9kB ± 0%: new 21.9kB ± 0%: delta: 0.00%
TmAllTrueLiteralList-4: old 1.74MB ± 0%: new 1.74MB ± 0%: delta: 0.00%
TmAllTrueFuncall-4: old 45.5kB ± 0%: new 45.5kB ± 0%: delta: 0.00%
TmAnyTrueLiteralList-4: old 37.9MB ± 0%: new 37.9MB ± 0%: delta: 0.00%
TmAnyTrueFuncall-4: old 45.6kB ± 0%: new 45.6kB ± 0%: delta: 0.00%
TmTernary-4: old 1.20kB ± 0%: new 1.20kB ± 0%: delta: 0.00%
TmTry-4: old 11.2kB ± 0%: new 11.2kB ± 0%: delta: 0.00%
metric: allocs/op
CloudReadLines-4: old 5.54k ± 0%: new 5.54k ± 0%: delta: 0.00%
CloudReadLine-4: old 60.0k ± 0%: new 60.0k ± 0%: delta: 0.00%
ListFiles-4: old 321 ± 0%: new 321 ± 0%: delta: 0.00%
Generate-4: old 25.9M ± 0%: new 25.9M ± 0%: delta: 0.00%
GenerateRegex-4: old 18.6M ± 0%: new 18.6M ± 0%: delta: 0.00%
TokensForExpressionComplex-4: old 4.84k ± 0%: new 4.84k ± 0%: delta: 0.00%
TokensForExpressionPlainStringNoNewline-4: old 20.0 ± 0%: new 20.0 ± 0%: delta: 0.00%
TokensForExpressionStringWith100Newlines-4: old 227 ± 0%: new 227 ± 0%: delta: 0.00%
TokensForExpressionObjectWith100KeysWithNumberValues-4: old 3.19k ± 0%: new 3.19k ± 0%: delta: 0.00%
TokensForExpression-4: old 4.84k ± 0%: new 4.84k ± 0%: delta: 0.00%
PartialEvalComplex-4: old 3.65k ± 0%: new 3.65k ± 0%: delta: 0.00%
PartialEvalSmallString-4: old 23.0 ± 0%: new 23.0 ± 0%: delta: 0.00%
PartialEvalHugeString-4: old 35.0 ± 0%: new 35.0 ± 0%: delta: 0.00%
PartialEvalHugeInterpolatedString-4: old 23.1k ± 0%: new 23.1k ± 0%: delta: 0.00%
PartialEvalObject-4: old 153 ± 0%: new 153 ± 0%: delta: 0.00%
TmAllTrueLiteralList-4: old 13.6k ± 0%: new 13.6k ± 0%: delta: 0.00%
TmAllTrueFuncall-4: old 460 ± 0%: new 460 ± 0%: delta: 0.00%
TmAnyTrueLiteralList-4: old 252k ± 0%: new 252k ± 0%: delta: 0.00%
TmAnyTrueFuncall-4: old 462 ± 0%: new 462 ± 0%: delta: 0.00%
TmTernary-4: old 28.0 ± 0%: new 28.0 ± 0%: delta: 0.00%
TmTry-4: old 147 ± 0%: new 147 ± 0%: delta: 0.00%