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#environment

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

Use .environment to define the environment that the job references. All environment protection rules must pass before a job referencing the environment is sent to a runner. For more information, see "Using environments for deployment."

You can provide the environment as only the environment name, or as an environment object with the name and url. The URL maps to environment_url in the deployments API. For more information about the deployments API, see "Deployments."

Using a single environment name
import { workflow } from 'https://deno.land/x/actionify@0.3.0/mod.ts';

const ci = workflow({ name: 'ci' })
  .job('setup', job => job.environment('production'));
Using environment name and URL
import { workflow } from 'https://deno.land/x/actionify@0.3.0/mod.ts';

const ci = workflow({ name: 'ci' })
  .job('setup', job => job.environment({
     name: 'production',
     url: 'https://github.com'
   }));

The URL can be an expression and can use any context except for the secrets context. For more information about expressions, see "Expressions."

Using output as URL
import { commands, e, workflow } from "https://deno.land/x/actionify@0.3.0/mod.ts";

const ci = workflow({ name: "ci" })
  .job("setup", (job) => {
    return job
      .step((step) => {
        return step
          .id("step_id")
          .run(commands.setOutput("url_output", "value"));
      })
      .environment((ctx) => ({
        name: "production",
        url: e.expr(ctx.steps.step_id.outputs.url_output),
      }));
  });

Parameters

environment: WithContext<EnvironmentOptions, Base, "jobs:jobId:environment" | "jobs:jobId:environment:url">