Skip to content

Commit

Permalink
Rename to job-context
Browse files Browse the repository at this point in the history
  • Loading branch information
omus committed Aug 13, 2024
1 parent 15f3cf4 commit 0784029
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 11 deletions.
51 changes: 40 additions & 11 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ jobs:
contents: read
steps:
- uses: actions/checkout@v4
- uses: ./job-name/
id: job-name
- uses: ./job-context/
id: job-context
- name: Matches expected name
run: '[[ "${output}" == "${expected}" ]] || exit 1'
env:
output: ${{ steps.job-name.outputs.job-name }}
output: ${{ steps.job-context.outputs.job-name }}
expected: "Job Name"

test-job-name-matrix:
Expand All @@ -186,12 +186,12 @@ jobs:
- "2.0"
steps:
- uses: actions/checkout@v4
- uses: ./job-name/
id: job-name
- uses: ./job-context/
id: job-context
- name: Matches expected name
run: '[[ "${output}" == "${expected}" ]] || exit 1'
env:
output: ${{ steps.job-name.outputs.job-name }}
output: ${{ steps.job-context.outputs.job-name }}
expected: "Job Name (${{ matrix.build.name }}, ${{ matrix.build.repo }}, ${{ matrix.version }})"
- name: Matches GitHub API name
run: |
Expand All @@ -204,7 +204,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
run_id: ${{ github.run_id }}
run_attempt: ${{ github.run_attempt }}
job_name: ${{ steps.job-name.outputs.job-name }}
job_name: ${{ steps.job-context.outputs.job-name }}

test-job-name-matrix-expr:
# TODO: Using `github.job` with any expressions results in it being empty
Expand All @@ -221,12 +221,12 @@ jobs:
- 2
steps:
- uses: actions/checkout@v4
- uses: ./job-name/
id: job-name
- uses: ./job-context/
id: job-context
- name: Matches expected name
run: '[[ "${output}" == "${expected}" ]] || exit 1'
env:
output: ${{ steps.job-name.outputs.job-name }}
output: ${{ steps.job-context.outputs.job-name }}
expected: ${{ github.event_name }} - - ${{ matrix.index }} - ${{ strategy.job-index }}
- name: Matches GitHub API name
run: |
Expand All @@ -239,4 +239,33 @@ jobs:
GH_TOKEN: ${{ github.token }}
run_id: ${{ github.run_id }}
run_attempt: ${{ github.run_attempt }}
job_name: ${{ steps.job-name.outputs.job-name }}
job_name: ${{ steps.job-context.outputs.job-name }}

test-job-name-ambiguous:
name: ${{ github.job }}
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
strategy:
fail-fast: false
matrix:
index:
- 1
- 2
steps:
- uses: actions/checkout@v4
- uses: ./job-context/
id: job-context
- name: Matches expected name
run: '[[ "${output}" == "${expected}" ]] || exit 1'
env:
output: ${{ steps.job-context.outputs.job-name }}
expected: ${{ github.job }}
- name: Matches GitHub API name
run: |
[[ $(jq length <<<"${job_ids}") -eq 2 ]] || exit 1
[[ -z "${job_id}" ]] || exit 1
env:
job_ids: ${{ steps.job-context.outputs.job-ids }}
job_id: ${{ steps.job-context.outputs.job-id }}
File renamed without changes.

0 comments on commit 0784029

Please sign in to comment.