From f3512a00e6cd037dab171a51ba683fde99b792e1 Mon Sep 17 00:00:00 2001 From: Taras Mankovski Date: Fri, 4 Oct 2024 16:56:55 -0400 Subject: [PATCH] Added missing JSON.stringify --- legacy/src/blog/2022-12-12-dynamic-github-action-jobs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/legacy/src/blog/2022-12-12-dynamic-github-action-jobs.md b/legacy/src/blog/2022-12-12-dynamic-github-action-jobs.md index 1e8b0430..6a52b515 100644 --- a/legacy/src/blog/2022-12-12-dynamic-github-action-jobs.md +++ b/legacy/src/blog/2022-12-12-dynamic-github-action-jobs.md @@ -151,7 +151,7 @@ const matrixList = ['package-a', 'package-b', 'package-c'].map((pkg) => ({ })); const includeStatement = { include: matrixList }; -console.log(`::set-output name=matrix::${includeStatement}`); +console.log(`::set-output name=matrix::${JSON.stringify(includeStatement)}`); ``` We use this script in the following workflow. It has two jobs: `generate-matrix` and `test`. In the `generate-matrix` job, we run the `matrix-script.js` shown above which logs the string to `stdout`. The `::set-output name=matrix::` is a special function within Github Actions which tells the runner to set this as an output value for this step. We assign it to a variable by setting the `id: set-matrix`. Finally, we can set it as an output for the whole job by specifying it in `outputs`.