diff --git a/internal/github/action.go b/internal/github/action.go index 5dec0c80..69f704bf 100644 --- a/internal/github/action.go +++ b/internal/github/action.go @@ -105,9 +105,7 @@ func (a *Action) repositoryName() string { func (a *Action) pullRequestNumber() int { event := struct { - PullRequest struct { - Number int `json:"number"` - } `json:"pull_request"` + PullRequestNumber int `json:"number"` }{} githubEventJSONFile, err := os.Open(filepath.Clean(os.Getenv("GITHUB_EVENT_PATH"))) panic.IfError(err) @@ -115,7 +113,7 @@ func (a *Action) pullRequestNumber() int { byteValue, _ := ioutil.ReadAll(githubEventJSONFile) panic.IfError(json.Unmarshal(byteValue, &event)) - return event.PullRequest.Number + return event.PullRequestNumber } func (a *Action) outputResult(result string) { diff --git a/internal/github/action_test.go b/internal/github/action_test.go index c4e661d7..ad20e8cb 100644 --- a/internal/github/action_test.go +++ b/internal/github/action_test.go @@ -273,7 +273,7 @@ func checkLabels() (int, *bytes.Buffer, *bytes.Buffer) { } func setPullRequestNumber(prNumber int) { - githubEventJSON := []byte(fmt.Sprintf(`{ "pull_request": { "number": %d } }`, prNumber)) + githubEventJSON := []byte(fmt.Sprintf(`{ "number": %d }`, prNumber)) os.WriteFile(gitHubEventFullPath(), githubEventJSON, os.ModePerm) //nolint }