0

I'm trying to make a Github Action that runs a "make check" step. If it succeeds, it should archive the test log as an artifact and continue to the next step. If it fails, it should upload the test log as an artifact then stop.

What I have is

jobs:
  build:
    steps:

    # Then a bunch of steps to download Cygwin and run autoconf and make, then...    

    - name: make check
      run: make check
      shell: C:\cygwin\bin\bash.exe -o igncr '{0}'
    - name: Archive test logs
      uses: actions/upload-artifact@v3
      with:
        name: logs
        path: test.log
    - name: make install
      run: make install
      shell: C:\cygwin\bin\bash.exe -o igncr '{0}'

Whether "make check" succeeds or fails, I'd like "Archive test logs" to run. But then "make install" shouldn't run if "make check" failed.

I did try adding 'continue-on-error: true' to the 'make check' step so that it always runs the "Archive test logs" step, which works. But then it runs 'make install' unnecessarily

Mike Gran
  • 33
  • 2
  • Did you try removing the `continue-on-error: true` from the `make check` step and add an `if: success() || failure()` to the `Archive test logs` step? – GuiFalourd Jun 01 '23 at 17:28
  • That seems to work. I hadn't tried it because, from the docs, I had guessed that the run would keep going. – Mike Gran Jun 01 '23 at 18:33
  • 2
    I found that this question was asked before here. https://stackoverflow.com/questions/58858429/how-to-run-a-github-actions-step-even-if-the-previous-step-fails-while-still-f – Mike Gran Jun 01 '23 at 18:35
  • Great! I'm glad you found a solution. I'll suggest closing the question as it's duplicated. – GuiFalourd Jun 01 '23 at 18:38

0 Answers0