Skip to content

Commit

Permalink
Add support for GITHUB_EVENT_PATH variable
Browse files Browse the repository at this point in the history
  • Loading branch information
kolomied committed Aug 1, 2022
1 parent 53821b4 commit 9227b4d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/commenter/commenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ More information available %s`,
}

func extractPullRequestNumber() (int, error) {
github_event_file := "/github/workflow/event.json"
github_event_file := os.Getenv("GITHUB_EVENT_PATH")
if github_event_file == "" {
github_event_file = "/github/workflow/event.json"
}

file, err := ioutil.ReadFile(github_event_file)
if err != nil {
fail(fmt.Sprintf("GitHub event payload not found in %s", github_event_file))
Expand Down

0 comments on commit 9227b4d

Please sign in to comment.