I have a mono repo containing many projects and a variable depth folder structure.
I have a number of tasks that need to run once only withing a folder that contains code changes this should run on all changes committed since the last push
Example test code looks like below:
name: code-analysis-doc-and-lint
on:
push:
branches:
- '**'
paths:
- '**/**'
jobs:
scan-files-for-changes:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.check-for-changes.outputs.folders }}
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: check-for-changes
id: code-scan
run: |
echo "::set-output name=folders::$(git diff-tree --diff-filter=d --no-commit-id --name-only -r ${{ github.sha }}| xargs -L1 dirname | uniq )"
echo ${{steps.check-for-changes.outputs.folders}}
- name: tf_docs
uses: Dirrk/terraform-docs@master
with:
tf_docs_working_dir: ${{steps.check-for-changes.outputs.folders}}
tf_docs_working_file: 'usage.md'
- name: Run Checkov
id: checkov
uses: bridgecrewio/checkov-action@master
with:
directory: ${{steps.check-for-changes.outputs.folders}}
skip_check: CKV_AZURE_1,CKV_AZURE_41
quiet: 'true'
framework: all
However whilst the "set-output name=folders::$(git diff-tree… " does show a unique list of folders that contain code changes. I don’t seem to be able to pass that list through as outputs to other jobs.
echo ${{steps.check-for-changes.outputs.folders}}
returns an empty folder.
I have also tried sending the output to an environment variable but I get an error saying the format is not supported.
Any advice is appreciated