Skip to content

Commit 2b5b38b

Browse files
authored
Add examples of the json output to the README (#55)
* Add examples of the json output to the README Signed-off-by: Rob Best <rob.best@chainguard.dev> * Remove second example Signed-off-by: Rob Best <rob.best@chainguard.dev> --------- Signed-off-by: Rob Best <rob.best@chainguard.dev>
1 parent 4322223 commit 2b5b38b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,29 @@ jobs:
6363
commit-message: Update images digests # optional
6464
```
6565
66+
The `json` output describes the updates that `digestabot` has made and makes it
67+
possible to extend the functionality of the action and act on the updates in
68+
subsequent steps.
69+
70+
The schema of the output is described in [`action.yml`](action.yml).
71+
72+
```yaml
73+
# Run digestabot
74+
- uses: chainguard-dev/digestabot@v1
75+
id: digestabot
76+
with:
77+
token: ${{ secrets.GITHUB_TOKEN }}
78+
79+
# Iterate over the updates in the `json` output
80+
- shell: bash
81+
run: |
82+
while read -r update; do
83+
updated_image=$(jq -r '.image + "@" + .updated_digest' <<<"${update}")
84+
85+
echo "Do something with ${updated_image} here."
86+
done < <(jq -c '.updates // [] | .[]' <<<'${{ steps.digestabot.outputs.json }}')
87+
```
88+
6689
## File examples
6790
6891
Here are some examples of files that digestabot can update:

0 commit comments

Comments
 (0)