Github Action not being triggered

I defined a simple workflow which looks like this:

name: Build & Test

on:
  push:
    paths:
      - 'src/Sting.Measurements/**'

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: Setup .NET Core
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 2.2.108
    - name: Build Sting.Application
      run: dotnet build --configuration Release src/Sting.Measurements/Sting.Application
    - name: Build Sting.Core
      run: dotnet build --configuration Release src/Sting.Measurements/Sting.Core
    - name: Build Sting.Devices
      run: dotnet build --configuration Release src/Sting.Measurements/Sting.Devices
    - name: Build Sting.Persistence
      run: dotnet build --configuration Release src/Sting.Measurements/Sting.Persistence

But when I push to the corresponding repo/directory, the action is not triggered. What am I missing?

Repo: https://github.com/RobinTTY/StructureMonitoring

2 Likes

I’m facing similar problem here: https://github.community/t5/GitHub-API-Development-and/GitHub-Actions-workflow-not-triggered-with-path/m-p/29872#M2745

I suspect GitHub Actions currently does not look into subdirectories recursively when given path/** pattern.

3 Likes

Update: The action now seems to actually run as intended what I changed is: (Update 2: no it does not)

paths:
- 'src/Sting.Measurements/\*'

So only one asterisk I suppose. This was actually how my workflow originally looked but no action was triggered maybe because it contained a syntax mistake with the initial commit (which I fixed but still no action was triggered). Only after deleting and recreating the workflow it seems to work now.

I can’t really tell what exactly the problem was since a lot of confusing stuff is happening. For instance dependabot triggered the action before I changed anything with a pull request which changed a file in _src/Sting.WebApp/… _which should not trigger the action…

Update 2: So the part where the action actually worked was an anomaly too. I created a new branch to verify the action is actually working reliably and it still does not work. I was able to reproduce what SamChou19815 said, the paths directive seems to not look for changes recursively.

See https://github.community/t5/GitHub-Actions/GitHub-Actions-workflow-not-triggered-with-path/m-p/30321#M400 for futher info.

You missed specifying the branch which should trigger the build

Sometimes GitHub Actions does not enter the “queued” state until 5 minutes after pushing. This can be misleading. I think it should move into queued state immediately, even if it doesn’t start running anything until later. This would improve UX and ease expectations in some cases.