Skip to content

Commit

Permalink
Reduced debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
omus committed Aug 16, 2024
1 parent 03f370f commit a0b2d0d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
with:
yaml: |
index: ${{ matrix.index }}
debug: true

test-simple:
name: Test Simple
Expand Down Expand Up @@ -92,6 +93,7 @@ jobs:
repo: ${{ matrix.build.repo }}
version_string: "${{ matrix.version }}"
version_number: ${{ matrix.version }}
debug: true

test-complex:
name: Test Complex
Expand Down Expand Up @@ -149,6 +151,7 @@ jobs:
continue-on-error: true
with:
yaml: ""
debug: true
- name: Action failed
if: ${{ steps.matrix-output.outcome != 'failure' }}
run: exit 1
Expand All @@ -167,12 +170,14 @@ jobs:
with:
yaml: |
demo: 1
debug: true
- uses: ./
id: matrix-output2
continue-on-error: true
with:
yaml: |
demo: 2
debug: true
- name: Action failed
if: ${{ steps.matrix-output1.outcome != 'success' || steps.matrix-output2.outcome != 'failure' }}
run: exit 1
Expand Down Expand Up @@ -200,6 +205,7 @@ jobs:
with:
yaml: |
index: ${{ matrix.index }}
debug: true
- if: ${{ strategy.job-index == 1 }}
run: sleep 30

Expand Down
11 changes: 8 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ inputs:
A string representing YAML data. Typically, a simple dictionary of key/value pairs.
type: string
required: true
debug:
description: >-
Enable debug logging for this specific action.
type: string
default: "false"
outputs:
json:
description: >-
Expand Down Expand Up @@ -53,7 +58,7 @@ runs:
# Determine artifact jobs
jobs="$(jq -rs '[.[].metadata."job-id"] | to_entries | map({id: .value, index: .key})' matrix-output/*/*.json)"
if [[ "$RUNNER_DEBUG" -eq 1 ]]; then
if [[ "$RUNNER_DEBUG" -eq 1 ]] || [[ "${{ input.debug }}" == "true" ]]; then
echo "Artifact jobs:" >&2
jq '.' <<<"${jobs}" >&2
fi
Expand Down Expand Up @@ -98,7 +103,7 @@ runs:
# Remove older jobs which were re-run
jobs="$(jq 'sort_by(.created_at) | reverse | unique_by(.name)' <<<"${jobs}")"
if [[ "$RUNNER_DEBUG" -eq 1 ]]; then
if [[ "$RUNNER_DEBUG" -eq 1 ]] || [[ "${{ input.debug }}" == "true" ]]; then
echo "Executed jobs:" >&2
jq '[.[] | {id, name, run_id, run_attempt, created_at, completed_at, conclusion}]' <<<"${jobs}" >&2
fi
Expand Down Expand Up @@ -129,7 +134,7 @@ runs:
echo "Matrix outputs produced: ${num_jobs}/${{ strategy.job-total }}" >&2
echo "Running jobs remaining: ${num_running_jobs}" >&2
if [[ "$RUNNER_DEBUG" -eq 1 ]]; then
if [[ "$RUNNER_DEBUG" -eq 1 ]] || [[ "${{ input.debug }}" == "true" ]]; then
echo "Matrix jobs:" >&2
jq '.' <<<"${matrix_jobs}" >&2
fi
Expand Down

0 comments on commit a0b2d0d

Please sign in to comment.