Skip to content

Internal job invocation that expects a lint failure result #4

Internal job invocation that expects a lint failure result

Internal job invocation that expects a lint failure result #4

name: Internal job invocation that expects a lint failure result
on:
workflow_dispatch:
inputs:
manifest_dir:
description: Directory containing the Cargo.toml manifest
required: false
type: string
default: .
rust_toolchain:
description: Version of the rust toolchain to run against
required: false
type: string
default: stable
cargo_clippy_args:
description: "Arguments to pass to `cargo clippy` in the test step"
type: string
jobs:
lints:
uses: "./.github/workflows/ci_baseline_rust_lints.yml"
with:
manifest_dir: ${{inputs.manifest_dir}}
rust_toolchain: ${{inputs.rust_toolchain}}
cargo_clippy_args: ${{inputs.cargo_clippy_args}}
_internal_continue_on_error: true
expect_failure:
runs-on: ubuntu-latest
needs: lints
steps:
- name: transform the outcomes
id: outcomes
env:
NEEDS_JSON: ${{toJSON(needs)}}
JQ_PROGRAM: >
.
| to_entries
| map({value: .value, key: (.key | sub("^failure_"; ""))})
| map(.value.outputs["_internal_" + .key + "_result"] == "failure")
| all
run: >
echo "all_failure=$(echo "$NEEDS_JSON" | jq "$JQ_PROGRAM")" | tee -a $GITHUB_OUTPUT
- name: expect failure
run: exit 1
if: steps.outcomes.outputs.all_failure != 'true'