From 7d1aec2041165e0f480a73d3486005cdbdb57f24 Mon Sep 17 00:00:00 2001 From: John Boyes Date: Sat, 10 Feb 2024 12:08:12 +0000 Subject: [PATCH] Fix magic number warning by extracting constant --- internal/github/action.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/github/action.go b/internal/github/action.go index cc37523..1c95d24 100644 --- a/internal/github/action.go +++ b/internal/github/action.go @@ -125,11 +125,14 @@ func (a *Action) pullRequestNumber() int { } func (a *Action) outputResult(result string) { + const UserReadWriteFilePermission = 0o644 + labelCheckOutput := fmt.Sprintf("label_check=%s", result) gitHubOutputFileName := filepath.Clean(os.Getenv("GITHUB_OUTPUT")) - githubOutputFile, err := os.OpenFile(gitHubOutputFileName, os.O_APPEND|os.O_WRONLY, 0o644) //nolint:gosec + githubOutputFile, err := os.OpenFile(gitHubOutputFileName, os.O_APPEND|os.O_WRONLY, UserReadWriteFilePermission) //nolint:gosec,lll panic.IfError(err) _, err = githubOutputFile.WriteString(labelCheckOutput) + if err != nil { closingErr := githubOutputFile.Close()