Created
November 29, 2019 07:49
-
-
Save christeredvartsen/0b77b01e5e7214343bc98843e5e53e67 to your computer and use it in GitHub Desktop.
Use output in a workflow step
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?= sprintf('::set-output name=var::%s', json_encode([ | |
[ | |
'id' => 'bar', | |
'name' => 'foo', | |
], | |
[ | |
'id' => 'bar2', | |
'name' => 'foo2', | |
], | |
])); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Use jq on output from step | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Run a command that sets an output with name var | |
id: do-stuff # This is referred to below when fetching output | |
run: php action.php | |
- name: Use jq to process JSON output from above command | |
run: | | |
echo '${{ steps.do-stuff.outputs.var }}' | jq '{id: .[].id}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
actions.php should look like the below now I guess?:
<?= sprintf('name=var >> $GITHUB_OUTPUT%s', json_encode([ [ 'id' => 'bar', 'name' => 'foo', ], [ 'id' => 'bar2', 'name' => 'foo2', ], ]));