Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable GitHub Checks "Re-run" button?

rerun example

I scoured everywhere in the docs. https://docs.github.com/en/rest/reference/checks#check-runs

At first, I thought it was the "actions" optional parameter in the UPDATE check API call. I thought it was some sort of default, so I added some dummy "Fix this" action. It added another button (NOT what I want).

So then I inspected the request that's made when I click the Re-run button, turns out, it is rerequest. https://github.com/w3-rre-test/ui-typescript-react/runs/4158592/rerequest

So then I looked everywhere for re-request, and i see it's a feature of Check Suite (but no way to turn that off).

It seems to call this endpoint: https://docs.github.com/en/rest/reference/checks#rerequest-a-check-suite

I don't want this feature, it's confusing my users. I also looked at this doc https://docs.github.com/en/github/administering-a-repository/managing-repository-settings/disabling-or-limiting-github-actions-for-a-repository#allowing-specific-actions-to-run, but I don't think it's the same "Action" api since i don't have the Actions tab in my org / repo.

like image 254
Ka Mok Avatar asked Jan 29 '26 04:01

Ka Mok


1 Answers

It's been a couple of years, but in the event someone stumbles across this and is curious how to do this:

At the time of writing, (Nov 2023) I'm not aware of a way to disable re-runs in GHA. However, there is a hack you put in on jobs you DON'T want users to be able to re-run.

Add this to the offending jobs:

if [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then
  echo "This is a rerun."
else
  echo "No re-runs for you. Go away."
  exit 1
fi

Example:

 no_reruns:
    runs-on: ubuntu-latest
    steps:
      - name: No reruns please
        run: |
         if [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then
            echo "No re-runs for you. Go away."
            exit 1
          else
            echo "not a re-run"
          fi
like image 109
user1428649 Avatar answered Feb 03 '26 07:02

user1428649



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!