upsidr / merge-gatekeeper

Get better merge control
MIT License
90 stars 15 forks source link

Fail early when other jobs have failed #14

Closed rytswd closed 2 years ago

rytswd commented 3 years ago

I'm not 100% sure, but I think the current logic only checks for the successful job setup, and goes into loop until they all succeed, regardless of the actual target job status.

We should be probably failing early if there is any other job that has failed quickly. Having Merge Gatekeeper running for 10 min is only wasteful of GitHub Action minutes.

rytswd commented 2 years ago

I could confirm this is the case, and also found that the log in GitHub Action is a bit difficult to understand.

start validator: merge-gatekeeper processing....
finish validator: merge-gatekeeper processing
finish validation loop processing
Error: error occurs validator: merge-gatekeeper, err: context deadline exceeded
Usage:
  merge-gatekeeper validate [flags]

Flags:
  -h, --help            help for validate
      --interval uint   set validate interval second (default 10)
      --ref string      set ref of github repository. the ref can be a SHA, a branch name, or tag name
  -r, --repo string     set github repository
  -s, --self string     set self job name (default "merge-gatekeeper")
      --timeout uint    set validate timeout second (default 600)

Global Flags:
  -t, --token string   set github token

failed to execute command: error occurs validator: merge-gatekeeper, err: context deadline exceeded

We should update the error message, and also remove the usage information being printed out in case of errors, as that won't be how GitHub Action consumer would use.