Closed robg-test closed 1 year ago
I would save yourself a bit of work here: https://github.com/philips-labs/list-folder-action
That being said, that action is doing very similar, and is rather old so is using the legacy
::set-output
.
Lifesaver. Has an example too which is great. I think thats fine. The terraform commands use set-output too so were tied into it already.
The terraform-docs@v1.0.0 is the only thing that uses ::set-output
, and it's actually fixed on main so might get a release in future: https://github.com/terraform-docs/gh-actions/issues/97
If we want to roll our own, here's a cut-down version:
determine-modules:
name: "Determine Terraform Modules"
runs-on: ubuntu-latest
outputs:
modules: ${{ steps.list-modules.outputs.modules }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Extract dirs from Terraform_Modules
id: list-modules
run: |
echo "modules=$(ls Terraform_modules | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
Ah am I missing outputs? Ill get that in tomorrow.
The latest thing I have is working, you need a seperate step for JQ as it's not installed as default on Ubuntu
jq is installed by default in the base image, the example I posted is a complete job that does everything needed, see here: https://github.com/AnswerConsulting/AnswerKing-Infrastructure/actions/runs/4117096124/jobs/7107977458
I would save yourself a bit of work here: https://github.com/philips-labs/list-folder-action
That being said, that action is doing very similar, and is rather old so is using the legacy
::set-output
.