Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another attempt at dynamic matrix #14

Merged
merged 8 commits into from
Feb 8, 2023
Merged

Another attempt at dynamic matrix #14

merged 8 commits into from
Feb 8, 2023

Conversation

robg-test
Copy link
Collaborator

No description provided.

@cmbuckley
Copy link
Member

cmbuckley commented Feb 7, 2023

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.

@robg-test
Copy link
Collaborator Author

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.

@cmbuckley
Copy link
Member

cmbuckley commented Feb 7, 2023

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: terraform-docs/gh-actions#97

@cmbuckley
Copy link
Member

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

@robg-test
Copy link
Collaborator Author

Ah am I missing outputs? Ill get that in tomorrow.

@robg-test
Copy link
Collaborator Author

robg-test commented Feb 8, 2023

The latest thing I have is working, you need a seperate step for JQ as it's not installed as default on Ubuntu

@cmbuckley
Copy link
Member

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

@cmbuckley cmbuckley self-requested a review February 8, 2023 12:09
@robg-test robg-test merged commit 068316a into main Feb 8, 2023
@robg-test robg-test deleted the TERRA-3 branch February 8, 2023 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants