image-actions icon indicating copy to clipboard operation
image-actions copied to clipboard

[Bug] Fails on a reopened PR

Open nathanaelhoun opened this issue 3 years ago • 5 comments

Describe the bug

When a PR is closed and then reopened, the action job fails with Error: Check run has action reopened . Wants: synchronize or opened

How To Reproduce

Steps to reproduce the behavior:

  1. Open a PR
  2. Wait for a job to finish
  3. Close the PR and then reopen it
  4. Job fails. See error

Expected behaviour

The jobs does not fail (either do not run or run and be skipped)

Additional context

Config:

name: Compress images
on: pull_request
jobs:
  build:
    name: calibreapp/image-actions
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - name: calibreapp/image-actions
        uses: docker://calibreapp/github-image-actions
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Relevant code seems to be entrypoint.js#L27

nathanaelhoun avatar Oct 03 '20 21:10 nathanaelhoun

@nathanaelhoun, image actions runs when a pull request is initiated or when a commit is added — just curious why you'd expect it to also when when you've re-opened a closed PR?

benschwarz avatar Oct 03 '20 21:10 benschwarz

@benschwarz In fact, I don't expect it to to run, I expect it to not fail and produce a check failure. I have updated my issue, it was not really exact

nathanaelhoun avatar Oct 03 '20 21:10 nathanaelhoun

Thanks for the clarification @nathanaelhoun.

To confirm, the issue is that it returns an error rather than a no-op?

GitHub must've changed that behaviour. Earlier versions of actions would have exited in this scenario.

Sounds like the update required will be to exit cleanly.

benschwarz avatar Oct 03 '20 23:10 benschwarz

Ref: https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/setting-exit-codes-for-actions

Seems like there isn't a no-op mode any longer. We'll need to exit with a success code.

benschwarz avatar Oct 04 '20 00:10 benschwarz

Thanks for the investigation @benschwarz! Exiting with a success code, rather than with an error code, is perfectly fine 👍

nathanaelhoun avatar Oct 04 '20 05:10 nathanaelhoun