Skip to content

Prevent multiline matrix payload from causing issues in GitHub workflow output #190

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

Merged
merged 3 commits into from
Feb 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ jobs:
# This provides a dedicated "check" to asynchronously test all integration tests within the tests/ directory
# The project name from the tests/ directory is then re-used within the "qa" job to run the generated "container"
# within that directory.
run: cd tests; echo "matrix=[\"$(ls -d * | tr '\n' ' ' | sed 's/ $//' | sed 's/ /\",\"/g')\"]" >> $GITHUB_OUTPUT
run: |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed ASWELL as pinning the version of jq-action? I would hope this change would be all that's needed?

Copy link
Member Author

@gsteel gsteel Feb 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so - But, if there's any chance that matrix is multiline, at least the case is covered. It should probably always have been like this WRT #150

We may be able to stick with jq-action@v2 if the multiline option works out for us.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change needs reverting as "matrix=[\"$(ls -d * | tr '\n' ' ' | sed 's/ $//' | sed 's/ /\",\"/g')\"]" should be on a single line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll send in another patch @internalsystemerror for 1.23

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ty <3

cd tests;
echo 'matrix<<EOF' >> $GITHUB_OUTPUT
echo "[\"$(ls -d * | tr '\n' ' ' | sed 's/ $//' | sed 's/ /\",\"/g')\"]" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT

container:
name: Prepare docker container
Expand Down Expand Up @@ -89,14 +93,16 @@ jobs:
- name: "Output generated matrix"
uses: sergeysova/jq-action@v2
with:
cmd: "jq . < <(echo '${{ steps.matrix_generation.outputs.matrix }}')"
multiline: true
cmd: "jq . < <(echo '${{ steps.matrix_generation.outputs.matrix }}')"

- name: Minify matrix from test directory
uses: sergeysova/jq-action@v2
id: expected_matrix
env:
PROJECT_NAME_TO_TEST: ${{ matrix.projectName }}
with:
multiline: true
cmd: 'jq -c . < tests/${PROJECT_NAME_TO_TEST}/matrix.json'

- name: "verify output of generated matrix for project: ${{ matrix.projectName }}"
Expand Down