1

I would like to trigger a Github action if the Pipfile is not touched.

I can do something like

on:
  push:
    branches:
      - master
    paths-ignore:
      - Pipfile*

but if a PR touches the Pipfile along with another non-Pipfile file, then the action triggers.

Is this possible?

5
  • To be sure that I understood you. You want to have workflow run when non-Pipfile is changed, right? Commented Dec 7, 2020 at 19:54
  • I want to have a workflow run when a Pipfile is not changed. It is a subtle difference but it matters. Commented Dec 8, 2020 at 0:45
  • Can you elaborate more? For instance with example folder/file structure? Commented Dec 8, 2020 at 5:50
  • Two files: Pipfile and foo.py. If only foo.py is modified, then action triggers. If only Pipfile is modified, then action doesn't trigger. If both foo.py and Pipfile is modified, then action doesn't trigger. Commented Dec 8, 2020 at 5:57
  • I'm afraid that this is not possible. You can only break a workflow if Pipefile is changed. Commented Dec 8, 2020 at 13:24

1 Answer 1

1

Two files: Pipfile and foo.py. If only foo.py is modified, then action triggers. If only Pipfile is modified, then action doesn't trigger. If both foo.py and Pipfile is modified, then action doesn't trigger

This is not possible, but what you need is actually a check step to see what file was changed and then exit workflow if Pipfile was changed. You can do this using this command

git diff-tree --no-commit-id --name-only -r ${{ github.sha }}

Sign up to request clarification or add additional context in comments.

1 Comment

This triggers even if the Pipfile is modified, which is not what I want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.