fountainhead / action-wait-for-check

A GitHub Action that waits for another Check Run to have completed
MIT License
122 stars 44 forks source link

Wait for latest Run #9

Open sfawcett123 opened 3 years ago

sfawcett123 commented 3 years ago

Great tool however, I have hit an occasional problem.

When I run the action and the waiting action fails. if I re-run the parent action it immediately sees there has been a previous run with a failure and fails, without waiting for the second run.

The code I run is:

       - name: Trigger Development Deployment
         uses: benc-uk/workflow-dispatch@v1.1
         with:
           workflow: Deploy to PaaS
           token: ${{ secrets.ACTIONS_API_ACCESS_TOKEN }}
           inputs: '{"environment": "Development", "sha": "${{ github.sha }}"}'
           ref: ${{github.ref}}

       - name: Wait for Deployment to Development
         uses: fountainhead/action-wait-for-check@v1.0.0
         id: wait-for-deploy
         with:
           token: ${{ secrets.ACTIONS_API_ACCESS_TOKEN}}
           checkName: Deploy Development
           ref: ${{github.ref}}

Retrieving check runs named Deploy Development on DFE-Digital/get-into-teaching-api@refs/heads/master... Retrieved 1 check runs named Deploy Development Found a completed check with id 1644407390 and conclusion failure

Is there any chance of a flag that allows 'latest-run: true' so it ignores previous runs?

bakoontz2 commented 2 years ago

By default, listForRef() in poll.ts returns the latest. However, I believe the problem is that without any delay before the call to listForRef(), at times the status from a previous run is returned. See #32 for a proposed solution.