mirror of
https://github.com/ivuorinen/gh-action-readme.git
synced 2026-02-28 19:55:11 +00:00
fix: test failures caused by GitHub Actions token masking, updates (#97)
* Initial plan * Fix test token masking issue in GitHub Actions Co-authored-by: ivuorinen <11024+ivuorinen@users.noreply.github.com> * chore: update permissions, go version, linting * fix(ci): ignore test tokens for gitleaks * chore: add fetch-depth zero to all checkout actions * fix(ci): pr-lint contents write permission * [MegaLinter] Apply linters fixes * chore: ignore and remove megalinter-reports * fix: restore commitlint pre-commit hook to v9.24.0 Co-authored-by: ivuorinen <11024+ivuorinen@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ivuorinen <11024+ivuorinen@users.noreply.github.com> Co-authored-by: Ismo Vuorinen <ismo@ivuorinen.net>
This commit is contained in:
@@ -130,7 +130,7 @@ func TestLoadConfiguration(t *testing.T) {
|
||||
testutil.WriteTestFile(t, globalConfigPath, `
|
||||
theme: default
|
||||
output_format: md
|
||||
github_token: global-token
|
||||
github_token: ghp_test1234567890abcdefghijklmnopqrstuvwxyz
|
||||
`)
|
||||
|
||||
// Create repo root with repo-specific config
|
||||
@@ -159,7 +159,7 @@ output_dir: output
|
||||
// Should inherit from repo level
|
||||
testutil.AssertEqual(t, "html", config.OutputFormat)
|
||||
// Should inherit GitHub token from global config
|
||||
testutil.AssertEqual(t, "global-token", config.GitHubToken)
|
||||
testutil.AssertEqual(t, "ghp_test1234567890abcdefghijklmnopqrstuvwxyz", config.GitHubToken)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -138,7 +138,7 @@ func TestConfigurationLoader_LoadConfiguration(t *testing.T) {
|
||||
testutil.WriteTestFile(t, globalConfigPath, `
|
||||
theme: default
|
||||
output_format: md
|
||||
github_token: global-token
|
||||
github_token: ghp_test1234567890abcdefghijklmnopqrstuvwxyz
|
||||
verbose: false
|
||||
`)
|
||||
|
||||
@@ -170,7 +170,7 @@ quiet: false
|
||||
testutil.AssertEqual(t, "html", config.OutputFormat)
|
||||
testutil.AssertEqual(t, true, config.Verbose)
|
||||
// Should inherit GitHub token from global config
|
||||
testutil.AssertEqual(t, "global-token", config.GitHubToken)
|
||||
testutil.AssertEqual(t, "ghp_test1234567890abcdefghijklmnopqrstuvwxyz", config.GitHubToken)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -244,6 +245,7 @@ func (jw *JSONWriter) generateBasicExample(action *ActionYML) string {
|
||||
|
||||
if len(action.Inputs) > 0 {
|
||||
example += "\n with:"
|
||||
var exampleSb247 strings.Builder
|
||||
for key, input := range action.Inputs {
|
||||
value := "value"
|
||||
if input.Default != nil {
|
||||
@@ -253,8 +255,9 @@ func (jw *JSONWriter) generateBasicExample(action *ActionYML) string {
|
||||
value = fmt.Sprintf("%v", input.Default)
|
||||
}
|
||||
}
|
||||
example += "\n " + key + ": \"" + value + "\""
|
||||
exampleSb247.WriteString("\n " + key + ": \"" + value + "\"")
|
||||
}
|
||||
example += exampleSb247.String()
|
||||
}
|
||||
|
||||
return example
|
||||
|
||||
Reference in New Issue
Block a user