I am trying to understand how to write a workflow. Basically, what I want to do is:
- Run a job with an action called technote-space/get-diff-action. This saves the diffs in an environment variable called
- After this I have five jobs that run tests. I only want to run these
if: env.GIT_DIFF, but the environment variable is created in another job so I don’t know how to refer to it.
Any idea how I can do this?
This is a reference workflow.yaml file:
jobs: get_git_diff: runs-on: self-hosted name: Get git diff steps: - uses: actions/checkout@v2 name: Checkout this repository - uses: email@example.com name: Get git diff id: get_git_diff with: PATTERNS: | !.version !README.md !docs/** !.github/** eslint_check: if: jobs.get_git_diff.steps.get_git_diff.env.GIT_DIFF needs: cancel_previous_actions timeout-minutes: 10 runs-on: [self-hosted] name: Run eslint check steps:
Obviously this doesn’t work. Can someone tell me how I can achieve the desired result? Running the diff check in another job would be cool because there are multiple test jobs. Otherwise, I would have to add it as a step in all jobs.
Any help is appreciated. Thanks in advance.