poseidon / wait-for-status-checks

GitHub Action that waits for check runs
https://github.com/marketplace/actions/wait-for-checks
Mozilla Public License 2.0
32 stars 13 forks source link

Ignore previously failed checks on pull_request edited #383

Open perryao opened 1 month ago

perryao commented 1 month ago

We have a workflow that checks the format of a PR title and it runs on

on:
  pull_request:
    types:
      - opened
      - synchronize
      - reopened
      - edited

If I open a PR with a title that fails this check, our summary workflow below fails as expected:

name: Summary
on:
  pull_request:
    types: [opened, synchronize, reopened, edited]
jobs:
  require-all-checks:
    name: Require All Checks
    runs-on: ubuntu-latest
    permissions:
      checks: read
    steps:
      - name: Wait for Status Checks
        uses: poseidon/wait-for-status-checks@v0.5.0
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          ignore: Require All Checks
          ignore_pattern: '\[Optional\].*'

However, if I edit the PR title and get the PR title workflow to run again and pass, the require-all-checks workflow still fails.

Is there a way to ignore previous failures on pull request edited triggers?

tylermichael commented 1 month ago
image

It looks like this API call returns the last runs and all their attempts by default, not just the last runs and their last attempt.

There would need to be code added to filter out just the previous runs and only look at the most recent attempts. IMO, that makes sense for this check to do.

bjhargrave commented 3 weeks ago

For type edited, the event payload.pull_request.head.sha is unchanged from the previous workflow run on the PR. Since this is the commit SHA used to locate the check runs, the check runs from the previous workflow run are visible. So the failed check-pr-title check run from the prior execution is visible before the new execution completes and updates the check run result to success. You probably need some other synchronization to ensure the check-pr-title job_id runs before the check status action checks it.

tylermichael commented 3 weeks ago

It fails even after you manually re-run the wait for status check. Only pushing a new commit allows it to pass.