Skip to content

How to execute Jobs if folder updated (recursive)? #25455

Answered by BrightRan
heathsnow asked this question in Actions
Discussion options

You must be logged in to vote

@heathsnow,

You can use “git diff” command to list all the changed files, and then check if all the changed files are under the directory “subdir/env1”. If all the changed files are under that directory, set an output with the value is true, otherwise false. Then according to the value of the output to run or not run the subsequent job which has the step echo “Updates made to env1”.
A simple example:

jobs:
  check:
    name: Check changed files
    outputs:
      run_job: ${{ steps.check_files.outputs.run_job }}
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          fetch-depth: 2
  - name: check files
    id: check_file…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants