Run validation job on failure

This commit is contained in:
Michael B. Gale
2026-10-19 12:04:51 +01:00
committed by GitHub
parent 5407aff91b
commit cba6f7b851
3 changed files with 10 additions and 2 deletions

View File

@@ -80,7 +80,7 @@ jobs:
CODEQL_ACTION_TESTING_ENVIRONMENT: codeql-action-pr-checks
CODEQL_ACTION_TEST_MODE: true
unsupported-macos-sarif-checks:
if: github.triggering_actor != 'dependabot[bot]'
if: github.triggering_actor != 'dependabot[bot]' && failure()
needs:
- unsupported-macos
permissions:

View File

@@ -33,6 +33,7 @@ validationJobs:
unsupported-macos-sarif-checks:
checkout: true
installNode: true
if: failure()
steps:
- name: Download workflow artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1

View File

@@ -124,6 +124,8 @@ interface JobSpecification {
type ValidationJobSpecification = JobSpecification & {
checkout?: boolean;
/** Optional condition for the validation job. */
if?: string;
};
/** Describes language/framework-specific steps and inputs. */
@@ -640,9 +642,14 @@ function generateValidationJob(
// Add the generated steps in front of the ones from the specification.
specSteps.items.unshift(...checkoutStep, ...steps);
const baseCondition = "github.triggering_actor != 'dependabot[bot]'";
const validationJob: Record<string, any> = {
name: jobSpecification.name,
if: "github.triggering_actor != 'dependabot[bot]'",
if:
jobSpecification.if !== undefined
? `${baseCondition} && ${jobSpecification.if}`
: baseCondition,
needs: [checkName],
permissions: {
contents: "read",