diff --git a/.github/workflows/comment_check_amalgamation.yml b/.github/workflows/comment_check_amalgamation.yml index c01572a44..fc96d5c18 100644 --- a/.github/workflows/comment_check_amalgamation.yml +++ b/.github/workflows/comment_check_amalgamation.yml @@ -37,6 +37,14 @@ jobs: var matchArtifact = artifacts.data.artifacts.filter((artifact) => { return artifact.name == "pr" })[0]; + // a run that failed before its jobs started (e.g. a stale queued + // run cancelled long after its push) has no artifact to report on + if (!matchArtifact) { + core.notice('Run ${{ github.event.workflow_run.id }} has no "pr" artifact; nothing to comment on.'); + core.setOutput('found', 'false'); + return; + } + core.setOutput('found', 'true'); var download = await github.rest.actions.downloadArtifact({ owner: context.repo.owner, repo: context.repo.repo, @@ -51,9 +59,11 @@ jobs: # Extract the untrusted PR artifact into a dedicated empty directory and # read only the two expected files by fixed path afterwards. This avoids a # malicious archive overwriting workspace files or escaping via ../ paths. - - run: unzip -o pr.zip -d ./pr_artifact + - if: steps.download.outputs.found == 'true' + run: unzip -o pr.zip -d ./pr_artifact - name: 'Comment on PR' + if: steps.download.outputs.found == 'true' uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/tests/src/unit-stl_helpers.cpp b/tests/src/unit-stl_helpers.cpp index 05c1e21bf..3d00236f8 100644 --- a/tests/src/unit-stl_helpers.cpp +++ b/tests/src/unit-stl_helpers.cpp @@ -78,7 +78,8 @@ TEST_CASE("detail::bit_cast") // to and from byte arrays const auto bytes = bit_cast>(std::uint32_t{0x01020304u}); - CHECK(bit_cast(bytes) == 0x01020304u); + // qualified: with a std::array argument, ADL would also find std::bit_cast in C++20 + CHECK(nlohmann::detail::bit_cast(bytes) == 0x01020304u); static_assert(noexcept(bit_cast(1.0)), "bit_cast must be noexcept"); }