Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beacon-biosignals/job-context
Provides additional context for the currently running job
https://github.com/beacon-biosignals/job-context
ci-cd github-action
Last synced: about 5 hours ago
JSON representation
Provides additional context for the currently running job
- Host: GitHub
- URL: https://github.com/beacon-biosignals/job-context
- Owner: beacon-biosignals
- License: mit
- Created: 2024-08-16T15:18:52.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-09-17T19:48:23.000Z (about 2 months ago)
- Last Synced: 2024-09-18T00:12:42.765Z (about 2 months ago)
- Topics: ci-cd, github-action
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 14
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Job Context
Provides additional context for the currently running job. GitHub Actions provides a [`job` context](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#job-context) but is missing some pieces including the job name and the job ID (the numeric value as used by the GitHub API).
## Requirements
The `job-context` action requires that the job in which this action is used has a job name that is unique within the workflow file. By default job names are unique so this is only a problem if you specify a custom `jobs..name`. If the job name is not unique within the workflow this action will fail and report the ambiguous job name.
Additionally, this job currently does not support job names which utilize GHA expressions using the contexts: `needs`, `vars`, or `inputs`.
## Examples
```yaml
# CI.yaml
jobs:
demo:
name: Demo
# These permissions are needed to:
# - Use `job-context`: https://github.com/beacon-biosignals/job-context#permissions
permissions:
context: read
runs-on: ubuntu-latest
strategy:
matrix:
version:
- "1.0"
- "2.0"
steps:
- uses: beacon-biosignals/job-context@v1
id: job
- run: |
echo "job-name=${{ steps.job.outputs.name }} # e.g. Demo (1.0)
echo "job-id=${{ steps.job.outputs.id }} # e.g. 28842064821
```## Inputs
The `job-context` action does not support any inputs.
## Outputs
| Name | Description | Example |
|:-------|:------------|:--------|
| `name` | The rendered job name. ||Demo (1.0)
| `id` | The numeric job ID as used by the GitHub API. Not be be confused with the workflow job key `github.job`. ||28842064821
## Permissions
The follow [job permissions](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs) are required to run this action:
```yaml
permissions:
context: read
```