Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 17 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,23 @@ jobs:
test "${{ steps.bad.outcome }}" = failure
test -z "${{ steps.bad.outputs.verdict }}"

# -version exits 0 before the outputs are opened, so no report is written.
# The step must still fail rather than pass on the previous use's outputs (#407).
- name: Use the action with -version
id: version
continue-on-error: true
uses: ./
with:
version: source
domain: lab.example
args: -version

- name: Check it failed without a report
shell: bash
run: |
test "${{ steps.version.outcome }}" = failure
test -z "${{ steps.version.outputs.verdict }}"

# found counts the -permute hits too (#363).
- name: Scan with -permute
id: permute
Expand Down
13 changes: 11 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ runs:
echo "Using the baseline an earlier step in this job saved."
exit 0
fi
run=$(gh api "repos/$GITHUB_REPOSITORY/actions/artifacts?name=$NAME&per_page=1" \
# upload-artifact allows &, +, # and % in names. Encode the name so the
# query string cannot truncate or reinterpret it (#407).
encoded=$(jq -rn --arg n "$NAME" '$n|@uri')
run=$(gh api "repos/$GITHUB_REPOSITORY/actions/artifacts?name=$encoded&per_page=1" \
--jq '.artifacts[0] | select(.expired == false) | .workflow_run.id // empty')
if [ -n "$run" ]; then
gh run download "$run" --repo "$GITHUB_REPOSITORY" --name "$NAME" --dir "$dir"
Expand Down Expand Up @@ -240,7 +243,13 @@ runs:
if [ "$resumed" = false ]; then
subenum "${flags[@]}" "${extra[@]}" "${target[@]}" > "$out/changes.jsonl" || code=$?
fi
if [ ! -s "$out/run.json" ]; then echo "::error::subenum exited $code without a report"; exit "$code"; fi
if [ ! -s "$out/run.json" ]; then
echo "::error::subenum exited $code without a report"
# -dry-run and -version exit 0 without writing a report; the step
# must still fail rather than pass on the previous use's outputs (#407).
[ "$code" -ne 0 ] || code=1
exit "$code"
fi

verdict=$(jq -r .verdict "$out/run.json")
reason=$(jq -r .reason "$out/run.json")
Expand Down
Loading