From 6eb6129f367d0558778fba2238a7cf37c785eac2 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Fri, 16 Aug 2024 11:05:03 -0500 Subject: [PATCH] fixup! Fallback on using job key --- .github/workflows/integration-tests.yaml | 6 +++--- action.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integration-tests.yaml b/.github/workflows/integration-tests.yaml index 7ffd03e..8cf9eb5 100644 --- a/.github/workflows/integration-tests.yaml +++ b/.github/workflows/integration-tests.yaml @@ -61,8 +61,8 @@ jobs: output: ${{ steps.job.outputs.name }} expected: test-empty-name - test-numeric-name: - name: 1 + test-null-name: + name: null runs-on: ubuntu-latest permissions: contents: read @@ -74,7 +74,7 @@ jobs: run: '[[ "${output}" == "${expected}" ]] || exit 1' env: output: ${{ steps.job.outputs.name }} - expected: 1 + expected: null test-matrix: name: Matrix diff --git a/action.yaml b/action.yaml index db96b20..351b347 100644 --- a/action.yaml +++ b/action.yaml @@ -36,7 +36,7 @@ runs: # e.g. octocat/hello-world/.github/workflows/my-workflow.yml@refs/heads/my_branch -> .github/workflows/my-workflow.yml workflow_path="$(echo "${workflow_ref%@*}" | cut -d/ -f3-)" - job_name_template="$(job_key="${job_key}" yq '.jobs[env(job_key)].name // empty' "${repo_path}/${workflow_path:?}")" + job_name_template="$(job_key="${job_key}" yq '.jobs[env(job_key)] | select(has("name")).name' "${repo_path}/${workflow_path:?}")" echo "name-template=${job_name_template}" | tee -a "$GITHUB_OUTPUT" env: repo_path: ${{ inputs.path || format('{0}/repo', github.action_path) }}