Skip to content

Commit

Permalink
gh-actions/github/env/save: Add action (#937)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Northey <ryan@synca.io>
  • Loading branch information
phlax authored Nov 4, 2023
1 parent 3343026 commit 481e7ac
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gh-actions/github/env/load/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ runs:
id: data
run: |
DATA=$(cat ${{ runner.temp }}/env.json)
echo "data=${DATA}" >> $GITHUB_OUTPUT
printf 'data=%s' "${DATA}" >> $GITHUB_OUTPUT
shell: bash
- uses: envoyproxy/toolshed/gh-actions/jq@actions-v0.1.10
id: toenv
Expand Down
22 changes: 22 additions & 0 deletions gh-actions/github/env/save/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

inputs:
env:
type: string
required: true


runs:
using: composite
steps:
- name: Save environment data
id: save
shell: bash
run: |
OUTPUT_DIR=$(mktemp -d)
echo '${{ inputs.env }}' >> "$OUTPUT_DIR/env.json"
echo "directory=${OUTPUT_DIR}" >> $GITHUB_OUTPUT
- name: Upload environment data
uses: actions/upload-artifact@v3
with:
name: env
path: ${{ steps.save.outputs.directory }}
36 changes: 36 additions & 0 deletions gh-actions/github/env/save/action.yml~
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

inputs:
run-id:
type: string
required: true

outputs:
data:
value: ${{ steps.data.outputs.data }}
output:
value: ${{ steps.toenv.outputs.value }}


runs:
using: composite
steps:
- name: Download environment data
id: download
uses: envoyproxy/toolshed/gh-actions/github/artifact/download@actions-v0.1.10
with:
name: env
path: ${{ runner.temp }}
run-id: ${{ inputs.run-id }}
- name: Load data
id: data
run: |
DATA=$(cat ${{ runner.temp }}/env.json)
echo "data=${DATA}" >> $GITHUB_OUTPUT
shell: bash
- uses: envoyproxy/toolshed/gh-actions/jq@actions-v0.1.10
id: toenv
with:
input: ${{ steps.data.outputs.data }}
options: -r
filter: |
to_entries[] | .key + "=" + (.value | tostring)

0 comments on commit 481e7ac

Please sign in to comment.