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

Added missing JSON.stringify #402

Open
wants to merge 1 commit into
base: production
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion legacy/src/blog/2022-12-12-dynamic-github-action-jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
Loading