Set job status to success even when a step fails

I have a workflow that does a checkout, runs a script, and creates a PR if a git diff has new content. git diff returns exit code 1 when there are changes in quiet mode , which I test for in the next step using failure() and run my PR code.

However, even when I’ve successfully run my step on failure, the action (scheduled to run each night) still reports overall failure. How can I set this job status to success overall even though one step returned an error code?

- name: diff content directory
      run: git diff --quiet archives/content/
    - name: PR if changes exist
      run: <some conditional commands to PR changes here>
      if: failure()

I’m afraid there are not ways to change the job status to be successful even a step in this job is failed. If your project really need this feature, I recommend that you can report a feature request here ( That will allow you to directly interact with the appropriate engineering team, and make it more convenient for the engineering team to collect and categorize your suggestions.

Note that you can suppress the error so that things keep running, by using the bash set command. Specifically, set +e before the potentially failing-but-not-actually-a-problem line(s), and then optionally set -e to turn immediate-exit back on again prior to calling instructions that should cause CI/CD to fail when they end in a non-zero exit code.

- name: List diff
  run: git diff --quiet archives/content/

- name: Commit changes
  run: |
    git config --local ""
    git config --local "CI/CD"
    set +e
    git add -A
    git commit -m "..."
    set -e

- name: Push changes
  uses: ad-m/github-push-action@master
    github_token: ${{ secrets.GITHUB_TOKEN }}  

(using a premade action for push-back in this example)

The work around is not so useful when invoking an action. For example some actions are flaky and I don’t want to fail my build just because some optional nice-to-have-step failed.