Home > OS >  Github action status check query
Github action status check query

Time:09-23

We have a few status checks added but due to the amount of time it takes to run 1 job, i would like to only have it run when specific files are changed.

I can update the job via the paths: aka:

on:
  pull_request:
    paths:
      - '**.tf'

but then we have to over right the merge request.

Is it possible to have a job that has to run for status checks but ONLY under a condition without having to do a manual intervention / override?

CodePudding user response:

You could use the action dorny/paths-filter to create edited file filters and then run the intensive task as a conditional step in the job. This means the required status check will still run but just skip a step.

on:
  pull_request:

jobs:
  bigjob:
    name: Some Big Job
    runs-on: ubuntu-latest
    steps:
      - name: Check for Modified TF Files
        uses: dorny/[email protected]
        id: filter
        with:
          filters: |
            tf:
              - '**/*.tf'
      # Only run step if files found
      - name: Run Task
        if: steps.filter.outputs.tf== 'true'
        shell: bash
        run: echo "some task"
  • Related