Github Actions: Required status check doesn't run due to files in paths not changed

Viewed 1120

Let's say I have a pull request like this.

name: Workflow

on:
   pull_request:
     paths:
       - '**/*.h'
       - '**/*.c'

I protect the master branch by configuring GitHub Actions to require the status check to pass before the pull request is mergable.

Now I update a readme doc. I open a pull request against master. The pull request is unmergable because the status check never returns a success nor does it return a fail.

Suggestions?

1 Answers

The docs suggest creating another action with the same name, that runs when the opposite condition is met. In your case, you'd want

name: Workflow

on:
   pull_request:
     paths-ignore:
       - '**/*.h'
       - '**/*.c'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - run: 'echo "No build required" '

Notice the paths-ignore.

https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks

Related