Home > other >  Triggering github workflow on a push, when a certain file is changed
Triggering github workflow on a push, when a certain file is changed

Time:11-01

Here's an example workflow

name: Example

on:
    pull_request:
        branches: [main, dev]
        types: [opened, reopened]
    push:
        paths:
            - './.github/workflows/always.yml'
jobs:
    print_dir:
    runs-on: ubuntu-latest
    steps:
      - name: print
        run: |
          ls -la .

This workflow doesn't seem to be triggered when the always.yml file is changed. However, if I change the pathsto paths_ignore, a change to any file not in under paths_ignore will trigger the workflow...

CodePudding user response:

Your issue is related to the path you informed in your configurations.

You need to use:

on:
    push:
        paths:
            - '.github/workflows/always.yml'

With '.github/workflows/always.yml' instead of './.github/workflows/always.yml'

  • Related