VortexHero
VortexHero

Reputation: 51

On GitHub Actions, how do I run a job if a specific file in a specific branch has been pushed to?

On GitHub Actions, how do I run a job if a specific file in a specific branch has been pushed to?

I've used the following workflow, but I don't know how to specify a specific branch for that file (such as the main branch):

on:
  push:
    paths: [ index.js ]

Thanks for the help! :)

Upvotes: 3

Views: 2209

Answers (1)

Tomasnorre
Tomasnorre

Reputation: 413

I have this running with.

Then it's only runs on push with changes in .github/workflows/BranchAndPath.yml and README.md

name: Branch & Path

on:  
  push:
    branches:
      - "**"
    paths: 
      - '.github/workflows/BranchAndPath.yml'
      - 'README.md'

Upvotes: 3

Related Questions