fix: address review nits - update doc comments, test names, and description wording

- Update getJobContext doc comment to include workflow identity fields
- Rename test to reflect all returned fields, not just status/check_run_id
- Rename validate test to 'job.workflow_* fields' covering all 4 properties
- Clarify workflow_ref description: 'ref path to' instead of 'ref of'
This commit is contained in:
Salman Muin Kayser Chishti
2026-04-14 10:55:58 +00:00
committed by GitHub
parent 0c9d817440
commit 763dff2018
4 changed files with 4 additions and 4 deletions
@@ -223,7 +223,7 @@
"description": "The path of the workflow file that contains the job. For example, `.github/workflows/my-workflow.yml`." "description": "The path of the workflow file that contains the job. For example, `.github/workflows/my-workflow.yml`."
}, },
"workflow_ref": { "workflow_ref": {
"description": "The ref of the workflow file that contains the job. For example, `octocat/hello-world/.github/workflows/my-workflow.yml@refs/heads/my_branch`." "description": "The ref path to the workflow file that contains the job. For example, `octocat/hello-world/.github/workflows/my-workflow.yml@refs/heads/my_branch`."
}, },
"workflow_repository": { "workflow_repository": {
"description": "The owner and repository name of the workflow file that contains the job. For example, `octocat/Hello-World`." "description": "The owner and repository name of the workflow file that contains the job. For example, `octocat/Hello-World`."
@@ -18,7 +18,7 @@ describe("job context", () => {
expect(context.pairs().length).toBe(0); expect(context.pairs().length).toBe(0);
}); });
it("returns status and check_run_id when job has no container or services", () => { it("returns status, check_run_id, and workflow fields when job has no container or services", () => {
const workflowContext = {job: {}} as WorkflowContext; const workflowContext = {job: {}} as WorkflowContext;
const context = getJobContext(workflowContext); const context = getJobContext(workflowContext);
+1 -1
View File
@@ -5,7 +5,7 @@ import {WorkflowContext} from "../context/workflow-context.js";
import {getDescription} from "./descriptions.js"; import {getDescription} from "./descriptions.js";
/** /**
* Returns the job context with container, services, status, and check_run_id. * Returns the job context with container, services, status, check_run_id, and workflow identity fields.
*/ */
export function getJobContext(workflowContext: WorkflowContext): DescriptionDictionary { export function getJobContext(workflowContext: WorkflowContext): DescriptionDictionary {
// https://docs.github.com/en/actions/learn-github-actions/contexts#job-context // https://docs.github.com/en/actions/learn-github-actions/contexts#job-context
@@ -432,7 +432,7 @@ jobs:
expect(result).toEqual([]); expect(result).toEqual([]);
}); });
it("job.workflow_ref", async () => { it("job.workflow_* fields", async () => {
const input = ` const input = `
on: push on: push