Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/actionify/src/job.ts>Job#if

Create and manage your GitHub workflows with TypeScript and Deno.
Latest
method Job.prototype.if
import { Job } from "https://deno.land/x/actionify@0.3.0/src/job.ts";

You can use the jobs.<job_id>.if conditional to prevent a job from running unless a condition is met. You can use any supported context and expression to create a conditional.

When you use expressions in an if conditional, you may omit the expression syntax (${{ }}) because GitHub automatically evaluates the if conditional as an expression. For more information, see "Expressions."

Example: Only run job for specific repository This example uses if to control when the production-deploy job can run. It will only run if the repository is named octo-repo-prod and is within the octo-org organization. Otherwise, the job will be marked as skipped.

import { workflow, e } from 'https://deno.land/x/actionify@0.3.0/mod.ts';

const ci = workflow({ name: "ci", fileName: "ci" })
  .on('push')
  .job('productionDeploy', job => {
    return job
      .if(e.op(e.ctx.github.repository, '==', 'octo-org/octo-repo-prod'))
  });

Parameters

statement: WithContext<ExpressionValue, Base, "jobs:jobId:if">