Skip to content

Commit

Permalink
Revert "Revert #386 (#393)" (#400)
Browse files Browse the repository at this point in the history
This reverts commit f7377ad.

That commit reverted #386 as a precautionary measure, while
[investigating a potential bug][1].  It turns out
[that there was no bug][2], though, so this commit reverts that revert.

[1]: #392
[2]: #392 (comment)
  • Loading branch information
johnboyes authored Sep 13, 2023
1 parent f7377ad commit 3160b64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions internal/github/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,17 @@ func (a *Action) repositoryName() string {

func (a *Action) pullRequestNumber() int {
event := struct {
PullRequestNumber int `json:"number"`
PullRequest struct {
Number int `json:"number"`
} `json:"pull_request"`
}{}
githubEventJSONFile, err := os.Open(filepath.Clean(os.Getenv("GITHUB_EVENT_PATH")))
panic.IfError(err)
defer githubEventJSONFile.Close() //nolint
byteValue, _ := ioutil.ReadAll(githubEventJSONFile)
panic.IfError(json.Unmarshal(byteValue, &event))

return event.PullRequestNumber
return event.PullRequest.Number
}

func (a *Action) outputResult(result string) {
Expand Down
2 changes: 1 addition & 1 deletion internal/github/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func checkLabels() (int, *bytes.Buffer, *bytes.Buffer) {
}

func setPullRequestNumber(prNumber int) {
githubEventJSON := []byte(fmt.Sprintf(`{ "number": %d }`, prNumber))
githubEventJSON := []byte(fmt.Sprintf(`{ "pull_request": { "number": %d } }`, prNumber))
os.WriteFile(gitHubEventFullPath(), githubEventJSON, os.ModePerm) //nolint
}

Expand Down

0 comments on commit 3160b64

Please sign in to comment.