Skip to content

Commit

Permalink
fix: logging, workflow reference validation (#640)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikburt authored Sep 26, 2024
1 parent 094e8de commit ba7692f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-timers-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gha-workflow-validator": patch
---

fix: proper logging during validation, fully skip validation of workflows
16 changes: 8 additions & 8 deletions actions/gha-workflow-validator/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24081,6 +24081,12 @@ async function validateActionReference(octokit, options, actionRef) {
if (!actionRef) {
return [];
}
if (actionRef.isWorkflowFile) {
core3.debug(
`Skipping validation for workflow reference: ${actionRef.owner}/${actionRef.repo}/${actionRef.repoPath}`
);
return [];
}
const validationErrors = [];
const shaRefValidation = validateShaRef(actionRef);
const versionCommentValidation = validateVersionCommentExists(actionRef);
Expand Down Expand Up @@ -24116,12 +24122,6 @@ function validateVersionCommentExists(actionReference) {
};
}
async function validateNodeActionVersion(octokit, actionRef) {
if (actionRef.isWorkflowFile) {
core3.debug(
`Skipping node version validation for ${actionRef.owner}/${actionRef.repo}/${actionRef.repoPath}`
);
return;
}
const actionFile = await getActionFileFromGithub(
octokit,
actionRef.owner,
Expand Down Expand Up @@ -24194,7 +24194,7 @@ var ActionsRunnerValidation = class {
this.options = options ?? {};
}
async validate(parsedFile) {
core4.debug(`Validating action references in ${parsedFile.filename}`);
core4.debug(`Validating gha runners in ${parsedFile.filename}`);
const { filename } = parsedFile;
const lineActionsRunners = mapAndFilterUndefined(
parsedFile.lines,
Expand Down Expand Up @@ -24358,7 +24358,7 @@ var IgnoresCommentValidation = class {
this.options = options ?? {};
}
async validate(parsedFile) {
core5.debug(`Validating action references in ${parsedFile.filename}`);
core5.debug(`Validating ignores comments in ${parsedFile.filename}`);
const { filename } = parsedFile;
const ignoreComments = mapAndFilterUndefined(
parsedFile.lines,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ async function validateActionReference(
return [];
}

if (actionRef.isWorkflowFile) {
core.debug(
`Skipping validation for workflow reference: ${actionRef.owner}/${actionRef.repo}/${actionRef.repoPath}`,
);
return [];
}

const validationErrors: ValidationMessage[] = [];

const shaRefValidation = validateShaRef(actionRef);
Expand Down Expand Up @@ -151,13 +158,6 @@ async function validateNodeActionVersion(
octokit: Octokit,
actionRef: ActionReference,
): Promise<ValidationMessage | undefined> {
if (actionRef.isWorkflowFile) {
core.debug(
`Skipping node version validation for ${actionRef.owner}/${actionRef.repo}/${actionRef.repoPath}`,
);
return;
}

const actionFile = await getActionFileFromGithub(
octokit,
actionRef.owner,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class ActionsRunnerValidation implements ValidationCheck {
}

async validate(parsedFile: ParsedFile): Promise<FileValidationResult> {
core.debug(`Validating action references in ${parsedFile.filename}`);
core.debug(`Validating gha runners in ${parsedFile.filename}`);
const { filename } = parsedFile;

const lineActionsRunners = mapAndFilterUndefined(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class IgnoresCommentValidation implements ValidationCheck {
}

async validate(parsedFile: ParsedFile): Promise<FileValidationResult> {
core.debug(`Validating action references in ${parsedFile.filename}`);
core.debug(`Validating ignores comments in ${parsedFile.filename}`);
const { filename } = parsedFile;

const ignoreComments = mapAndFilterUndefined(
Expand Down

0 comments on commit ba7692f

Please sign in to comment.