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:
committed by
GitHub
parent
0c9d817440
commit
763dff2018
@@ -223,7 +223,7 @@
|
||||
"description": "The path of the workflow file that contains the job. For example, `.github/workflows/my-workflow.yml`."
|
||||
},
|
||||
"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": {
|
||||
"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);
|
||||
});
|
||||
|
||||
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 context = getJobContext(workflowContext);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import {WorkflowContext} from "../context/workflow-context.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 {
|
||||
// https://docs.github.com/en/actions/learn-github-actions/contexts#job-context
|
||||
|
||||
@@ -432,7 +432,7 @@ jobs:
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
|
||||
it("job.workflow_ref", async () => {
|
||||
it("job.workflow_* fields", async () => {
|
||||
const input = `
|
||||
on: push
|
||||
|
||||
|
||||
Reference in New Issue
Block a user