Skip to main content

github Submodule

Constructs ​

AutoApprove ​

Auto approve pull requests that meet a criteria.

Initializers ​

import { github } from 'projen'

new github.AutoApprove(github: GitHub, options?: AutoApproveOptions)
NameTypeDescription
github
GitHub
No description.
options
AutoApproveOptions
No description.

githubRequired ​

optionsOptional ​

Methods ​

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
Synthesizes files to the project output directory.
addSource
Auto-approve pull requests from this source, in addition to the configured sources.

toString ​
public toString(): string

Returns a string representation of this construct.

with ​
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired ​
  • Type: ...constructs.IMixin[]

The mixins to apply.


postProjectCreation ​
public postProjectCreation(initProject: InitProject): void

Called once, right after postSynthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST. Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate feedback on their new project. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


postSynthesize ​
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize ​
public preSynthesize(): void

Called before synthesis.

projectCreation ​
public projectCreation(initProject: InitProject): void

Called once, right after synthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). Use it for deterministic, one-off file generation. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


synthesize ​
public synthesize(): void

Synthesizes files to the project output directory.

addSource ​
public addSource(source: PullRequestSource): void

Auto-approve pull requests from this source, in addition to the configured sources.

Adding a source replaces the default source.

sourceRequired ​

Static Functions ​

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct ​
import { github } from 'projen'

github.AutoApprove.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired ​
  • Type: any

Any object.


isComponent ​
import { github } from 'projen'

github.AutoApprove.isComponent(x: any)

Test whether the given construct is a component.

xRequired ​
  • Type: any

Properties ​

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
label
stringNo description.

nodeRequired ​
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired ​
public readonly project: Project;
  • Type: projen.Project

labelRequired ​
public readonly label: string;
  • Type: string

AutoMerge ​

Automatically merge Pull Requests using Mergify.

[!NOTE] GitHub now natively provides the same features, so you don't need Mergify anymore. See GitHubOptions.mergeQueue and MergeQueueOptions.autoQueue.

If buildJob is specified, the specified GitHub workflow job ID is required to succeed in order for the PR to be merged.

approvedReviews specified the number of code review approvals required for the PR to be merged.

https://mergify.com/

Initializers ​

import { github } from 'projen'

new github.AutoMerge(github: GitHub, options?: AutoMergeOptions)
NameTypeDescription
github
GitHub
No description.
options
AutoMergeOptions
No description.

githubRequired ​

optionsOptional ​

Methods ​

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
Synthesizes files to the project output directory.
addConditions
Adds conditions to the auto merge rule.
addConditionsLater
Adds conditions that will be rendered only during synthesis.

toString ​
public toString(): string

Returns a string representation of this construct.

with ​
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired ​
  • Type: ...constructs.IMixin[]

The mixins to apply.


postProjectCreation ​
public postProjectCreation(initProject: InitProject): void

Called once, right after postSynthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST. Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate feedback on their new project. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


postSynthesize ​
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize ​
public preSynthesize(): void

Called before synthesis.

projectCreation ​
public projectCreation(initProject: InitProject): void

Called once, right after synthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). Use it for deterministic, one-off file generation. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


synthesize ​
public synthesize(): void

Synthesizes files to the project output directory.

addConditions ​
public addConditions(conditions: ...string[]): void

Adds conditions to the auto merge rule.

conditionsRequired ​
  • Type: ...string[]

The conditions to add (mergify syntax).


addConditionsLater ​
public addConditionsLater(later: IAddConditionsLater): void

Adds conditions that will be rendered only during synthesis.

laterRequired ​

The later.


Static Functions ​

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct ​
import { github } from 'projen'

github.AutoMerge.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired ​
  • Type: any

Any object.


isComponent ​
import { github } from 'projen'

github.AutoMerge.isComponent(x: any)

Test whether the given construct is a component.

xRequired ​
  • Type: any

Properties ​

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.

nodeRequired ​
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired ​
public readonly project: Project;
  • Type: projen.Project

AutoQueue ​

Automatically add pull requests to the merge queue PRs will be merged once they pass required checks.

Initializers ​

import { github } from 'projen'

new github.AutoQueue(scope: IConstruct, options?: AutoQueueOptions)
NameTypeDescription
scope
constructs.IConstructNo description.
options
AutoQueueOptions
No description.

scopeRequired ​
  • Type: constructs.IConstruct

optionsOptional ​

Methods ​

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
Synthesizes files to the project output directory.

toString ​
public toString(): string

Returns a string representation of this construct.

with ​
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired ​
  • Type: ...constructs.IMixin[]

The mixins to apply.


postProjectCreation ​
public postProjectCreation(initProject: InitProject): void

Called once, right after postSynthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST. Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate feedback on their new project. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


postSynthesize ​
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize ​
public preSynthesize(): void

Called before synthesis.

projectCreation ​
public projectCreation(initProject: InitProject): void

Called once, right after synthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). Use it for deterministic, one-off file generation. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


synthesize ​
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions ​

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct ​
import { github } from 'projen'

github.AutoQueue.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired ​
  • Type: any

Any object.


isComponent ​
import { github } from 'projen'

github.AutoQueue.isComponent(x: any)

Test whether the given construct is a component.

xRequired ​
  • Type: any

Properties ​

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.

nodeRequired ​
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired ​
public readonly project: Project;
  • Type: projen.Project

Dependabot ​

Defines dependabot configuration for node projects.

Since module versions are managed in projen, the versioning strategy will be configured to "lockfile-only" which means that only updates that can be done on the lockfile itself will be proposed.

Initializers ​

import { github } from 'projen'

new github.Dependabot(github: GitHub, options?: DependabotOptions)
NameTypeDescription
github
GitHub
No description.
options
DependabotOptions
No description.

githubRequired ​

optionsOptional ​

Methods ​

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
Synthesizes files to the project output directory.
addAllow
Allows a dependency from automatic updates.
addIgnore
Ignores a dependency from automatic updates.

toString ​
public toString(): string

Returns a string representation of this construct.

with ​
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired ​
  • Type: ...constructs.IMixin[]

The mixins to apply.


postProjectCreation ​
public postProjectCreation(initProject: InitProject): void

Called once, right after postSynthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST. Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate feedback on their new project. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


postSynthesize ​
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize ​
public preSynthesize(): void

Called before synthesis.

projectCreation ​
public projectCreation(initProject: InitProject): void

Called once, right after synthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). Use it for deterministic, one-off file generation. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


synthesize ​
public synthesize(): void

Synthesizes files to the project output directory.

addAllow ​
public addAllow(dependencyName: string): void

Allows a dependency from automatic updates.

dependencyNameRequired ​
  • Type: string

Use to allow updates for dependencies with matching names, optionally using * to match zero or more characters.


addIgnore ​
public addIgnore(dependencyName: string, versions: ...string[]): void

Ignores a dependency from automatic updates.

dependencyNameRequired ​
  • Type: string

Use to ignore updates for dependencies with matching names, optionally using * to match zero or more characters.


versionsRequired ​
  • Type: ...string[]

Use to ignore specific versions or ranges of versions.

If you want to define a range, use the standard pattern for the package manager (for example: ^1.0.0 for npm, or ~> 2.0 for Bundler).


Static Functions ​

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct ​
import { github } from 'projen'

github.Dependabot.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired ​
  • Type: any

Any object.


isComponent ​
import { github } from 'projen'

github.Dependabot.isComponent(x: any)

Test whether the given construct is a component.

xRequired ​
  • Type: any

Properties ​

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
config
anyThe raw dependabot configuration.
ignoresProjen
booleanWhether or not projen is also upgraded in this config,.

nodeRequired ​
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired ​
public readonly project: Project;
  • Type: projen.Project

configRequired ​
public readonly config: any;
  • Type: any

The raw dependabot configuration.

https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates


ignoresProjenRequired ​
public readonly ignoresProjen: boolean;
  • Type: boolean

Whether or not projen is also upgraded in this config,.


DependencyReview ​

Adds a GitHub workflow that runs the dependency-review-action on pull requests.

This action scans pull requests for dependency changes and raises an error if any vulnerabilities or invalid licenses are introduced.

https://github.com/actions/dependency-review-action

Initializers ​

import { github } from 'projen'

new github.DependencyReview(github: GitHub, options?: DependencyReviewOptions)
NameTypeDescription
github
GitHub
No description.
options
DependencyReviewOptions
No description.

githubRequired ​

optionsOptional ​

Methods ​

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
Synthesizes files to the project output directory.

toString ​
public toString(): string

Returns a string representation of this construct.

with ​
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired ​
  • Type: ...constructs.IMixin[]

The mixins to apply.


postProjectCreation ​
public postProjectCreation(initProject: InitProject): void

Called once, right after postSynthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST. Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate feedback on their new project. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


postSynthesize ​
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize ​
public preSynthesize(): void

Called before synthesis.

projectCreation ​
public projectCreation(initProject: InitProject): void

Called once, right after synthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). Use it for deterministic, one-off file generation. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


synthesize ​
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions ​

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct ​
import { github } from 'projen'

github.DependencyReview.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired ​
  • Type: any

Any object.


isComponent ​
import { github } from 'projen'

github.DependencyReview.isComponent(x: any)

Test whether the given construct is a component.

xRequired ​
  • Type: any

Properties ​

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.

nodeRequired ​
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired ​
public readonly project: Project;
  • Type: projen.Project

GitHub ​

Initializers ​

import { github } from 'projen'

new github.GitHub(project: Project, options?: GitHubOptions)
NameTypeDescription
project
projen.ProjectNo description.
options
GitHubOptions
No description.

projectRequired ​
  • Type: projen.Project

optionsOptional ​

Methods ​

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
Synthesizes files to the project output directory.
addDependabot
No description.
addPullRequestTemplate
No description.
addWorkflow
Adds a workflow to the project.
runsOnConfig
Resolves the runsOn/runsOnGroup config for a job, falling back to the project's global runner selection (workflowRunsOn/workflowRunsOnGroup) when options does not specify one.
tryFindWorkflow
Finds a GitHub workflow by name.

toString ​
public toString(): string

Returns a string representation of this construct.

with ​
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired ​
  • Type: ...constructs.IMixin[]

The mixins to apply.


postProjectCreation ​
public postProjectCreation(initProject: InitProject): void

Called once, right after postSynthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST. Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate feedback on their new project. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


postSynthesize ​
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize ​
public preSynthesize(): void

Called before synthesis.

projectCreation ​
public projectCreation(initProject: InitProject): void

Called once, right after synthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). Use it for deterministic, one-off file generation. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


synthesize ​
public synthesize(): void

Synthesizes files to the project output directory.

addDependabot ​
public addDependabot(options?: DependabotOptions): Dependabot
optionsOptional ​

addPullRequestTemplate ​
public addPullRequestTemplate(content: ...string[]): PullRequestTemplate
contentRequired ​
  • Type: ...string[]

addWorkflow ​
public addWorkflow(name: string): GithubWorkflow

Adds a workflow to the project.

nameRequired ​
  • Type: string

Name of the workflow.


runsOnConfig ​
public runsOnConfig(options?: RunsOnOptions): RunsOnConfig

Resolves the runsOn/runsOnGroup config for a job, falling back to the project's global runner selection (workflowRunsOn/workflowRunsOnGroup) when options does not specify one.

optionsOptional ​
  • Type: projen.RunsOnOptions

per-job runner selection that takes precedence over the project's global default.


tryFindWorkflow ​
public tryFindWorkflow(name: string): GithubWorkflow

Finds a GitHub workflow by name.

Returns undefined if the workflow cannot be found.

nameRequired ​
  • Type: string

The name of the GitHub workflow.


Static Functions ​

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.
of
Returns the GitHub component of a project or undefined if the project does not have a GitHub component.

isConstruct ​
import { github } from 'projen'

github.GitHub.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired ​
  • Type: any

Any object.


isComponent ​
import { github } from 'projen'

github.GitHub.isComponent(x: any)

Test whether the given construct is a component.

xRequired ​
  • Type: any

of ​
import { github } from 'projen'

github.GitHub.of(project: Project)

Returns the GitHub component of a project or undefined if the project does not have a GitHub component.

projectRequired ​
  • Type: projen.Project

Properties ​

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
actions
GitHubActionsProvider
The GitHub Actions provider used to manage the versions of actions used in steps.
checkoutSubmodules
CheckoutSubmodules
Whether checking out Git submodules is enabled for this GitHub project.
downloadLfs
booleanWhether downloading from LFS is enabled for this GitHub project.
projenCredentials
GithubCredentials
GitHub API authentication method used by projen workflows.
workflows
GithubWorkflow[]
All workflows.
workflowsEnabled
booleanAre workflows enabled?
mergeQueue
MergeQueue
The MergeQueue component configured on this repository This is undefined if merge queues are not enabled for this repository.
mergify
Mergify
The Mergify component configured on this repository This is undefined if Mergify is not enabled for this repository.

nodeRequired ​
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired ​
public readonly project: Project;
  • Type: projen.Project

actionsRequired ​
public readonly actions: GitHubActionsProvider;

The GitHub Actions provider used to manage the versions of actions used in steps.


checkoutSubmodulesRequired ​
public readonly checkoutSubmodules: CheckoutSubmodules;

Whether checking out Git submodules is enabled for this GitHub project.


downloadLfsRequired ​
public readonly downloadLfs: boolean;
  • Type: boolean

Whether downloading from LFS is enabled for this GitHub project.


projenCredentialsRequired ​
public readonly projenCredentials: GithubCredentials;

GitHub API authentication method used by projen workflows.


workflowsRequired ​
public readonly workflows: GithubWorkflow[];

All workflows.


workflowsEnabledRequired ​
public readonly workflowsEnabled: boolean;
  • Type: boolean

Are workflows enabled?


mergeQueueOptional ​
public readonly mergeQueue: MergeQueue;

The MergeQueue component configured on this repository This is undefined if merge queues are not enabled for this repository.


mergifyOptional ​
public readonly mergify: Mergify;

The Mergify component configured on this repository This is undefined if Mergify is not enabled for this repository.


GitHubProject ​

GitHub-based project.

Initializers ​

import { github } from 'projen'

new github.GitHubProject(options: GitHubProjectOptions)
NameTypeDescription
options
GitHubProjectOptions
No description.

optionsRequired ​

Methods ​

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
addExcludeFromCleanup
Exclude the matching files from pre-synth cleanup.
addGitIgnore
Adds a .gitignore pattern.
addPackageIgnore
Exclude these files from the bundled package.
addTask
Adds a new task to this project.
annotateGenerated
Marks the provided file(s) as being generated.
postSynthesize
Called after all components are synthesized.
preSynthesize
Called before all components are synthesized.
removeTask
Removes a task from a project.
runTaskCommand
Returns the shell command to execute in order to run a task.
synth
Synthesize all project files into outdir.
tryFindFile
Finds a file at the specified relative path within this project and all its subprojects.
tryFindObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
tryRemoveFile
Finds a file at the specified relative path within this project and removes it.

toString ​
public toString(): string

Returns a string representation of this construct.

with ​
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired ​
  • Type: ...constructs.IMixin[]

The mixins to apply.


addExcludeFromCleanup ​
public addExcludeFromCleanup(globs: ...string[]): void

Exclude the matching files from pre-synth cleanup.

Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.

globsRequired ​
  • Type: ...string[]

The glob patterns to match.


addGitIgnore ​
public addGitIgnore(pattern: string): void

Adds a .gitignore pattern.

patternRequired ​
  • Type: string

The glob pattern to ignore.


addPackageIgnore ​
public addPackageIgnore(_pattern: string): void

Exclude these files from the bundled package.

Implemented by project types based on the packaging mechanism. For example, NodeProject delegates this to .npmignore.

_patternRequired ​
  • Type: string

The glob pattern to exclude.


addTask ​
public addTask(name: string, props?: TaskOptions): Task

Adds a new task to this project.

This will fail if the project already has a task with this name.

nameRequired ​
  • Type: string

The task name to add.


propsOptional ​
  • Type: projen.TaskOptions

Task properties.


annotateGenerated ​
public annotateGenerated(glob: string): void

Marks the provided file(s) as being generated.

This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.

https://github.com/github/linguist/blob/master/docs/overrides.md

globRequired ​
  • Type: string

the glob pattern to match (could be a file path).


postSynthesize ​
public postSynthesize(): void

Called after all components are synthesized.

Order is not guaranteed.

preSynthesize ​
public preSynthesize(): void

Called before all components are synthesized.

removeTask ​
public removeTask(name: string): Task

Removes a task from a project.

nameRequired ​
  • Type: string

The name of the task to remove.


runTaskCommand ​
public runTaskCommand(task: Task): string

Returns the shell command to execute in order to run a task.

By default, this is npx projen@<version> <task>

taskRequired ​
  • Type: projen.Task

The task for which the command is required.


synth ​
public synth(): void

Synthesize all project files into outdir.

  1. Call "this.preSynthesize()"
  2. Delete all generated files
  3. Synthesize all subprojects
  4. Synthesize all components of this project
  5. Call "projectCreation()" for all components, only if the project is being created for the first time
  6. Call "postSynthesize()" for all components of this project
  7. Call "this.postSynthesize()"
  8. Call "postProjectCreation()" for all components, only if the project is being created for the first time
tryFindFile ​
public tryFindFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and all its subprojects.

filePathRequired ​
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


tryFindObjectFile ​
public tryFindObjectFile(filePath: string): ObjectFile

Finds an object file (like JsonFile, YamlFile, etc.) by name.

filePathRequired ​
  • Type: string

The file path.


tryRemoveFile ​
public tryRemoveFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and removes it.

filePathRequired ​
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


Static Functions ​

NameDescription
isConstruct
Checks if x is a construct.
isProject
Test whether the given construct is a project.
of
Find the closest ancestor project for given construct.

isConstruct ​
import { github } from 'projen'

github.GitHubProject.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired ​
  • Type: any

Any object.


isProject ​
import { github } from 'projen'

github.GitHubProject.isProject(x: any)

Test whether the given construct is a project.

xRequired ​
  • Type: any

of ​
import { github } from 'projen'

github.GitHubProject.of(construct: IConstruct)

Find the closest ancestor project for given construct.

When given a project, this it the project itself.

constructRequired ​
  • Type: constructs.IConstruct

Properties ​

NameTypeDescription
node
constructs.NodeThe tree node.
buildTask
projen.TaskNo description.
commitGenerated
booleanWhether to commit the managed files by default.
compileTask
projen.TaskNo description.
components
projen.Component[]Returns all the components within this project.
deps
projen.DependenciesProject dependencies.
ejected
booleanWhether or not the project is being ejected.
files
projen.FileBase[]All files in this project.
gitattributes
projen.GitAttributesFileThe .gitattributes file for this repository.
gitignore
projen.IgnoreFile.gitignore.
logger
projen.LoggerLogging utilities.
name
stringProject name.
outdir
stringAbsolute output directory of this project.
packageTask
projen.TaskNo description.
postCompileTask
projen.TaskNo description.
preCompileTask
projen.TaskNo description.
projectBuild
projen.ProjectBuildManages the build process of the project.
projenCommand
stringThe command to use in order to run the projen CLI.
root
projen.ProjectThe root project.
subprojects
projen.Project[]Returns all the subprojects within this project.
tasks
projen.TasksProject tasks.
testTask
projen.TaskNo description.
defaultTask
projen.TaskThis is the "default" task, the one that executes "projen".
initProject
projen.InitProjectThe options used when this project is bootstrapped via projen new.
parent
projen.ProjectA parent project.
autoApprove
AutoApprove
Auto approve set up for this project.
devContainer
projen.vscode.DevContainerAccess for .devcontainer.json (used for GitHub Codespaces).
github
GitHub
Access all github components.
gitpod
projen.GitpodAccess for Gitpod.
vscode
projen.vscode.VsCodeAccess all VSCode components.

nodeRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly node: Node;
  • Type: constructs.Node

The tree node.


buildTaskRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly buildTask: Task;
  • Type: projen.Task

commitGeneratedRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly commitGenerated: boolean;
  • Type: boolean

Whether to commit the managed files by default.


compileTaskRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly compileTask: Task;
  • Type: projen.Task

componentsRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly components: Component[];
  • Type: projen.Component[]

Returns all the components within this project.


depsRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly deps: Dependencies;
  • Type: projen.Dependencies

Project dependencies.


ejectedRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly ejected: boolean;
  • Type: boolean

Whether or not the project is being ejected.


filesRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly files: FileBase[];
  • Type: projen.FileBase[]

All files in this project.


gitattributesRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly gitattributes: GitAttributesFile;
  • Type: projen.GitAttributesFile

The .gitattributes file for this repository.


gitignoreRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly gitignore: IgnoreFile;
  • Type: projen.IgnoreFile

.gitignore.


loggerRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly logger: Logger;
  • Type: projen.Logger

Logging utilities.


nameRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly name: string;
  • Type: string

Project name.


outdirRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly outdir: string;
  • Type: string

Absolute output directory of this project.


packageTaskRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly packageTask: Task;
  • Type: projen.Task

postCompileTaskRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly postCompileTask: Task;
  • Type: projen.Task

preCompileTaskRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly preCompileTask: Task;
  • Type: projen.Task

projectBuildRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly projectBuild: ProjectBuild;
  • Type: projen.ProjectBuild

Manages the build process of the project.


projenCommandRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly projenCommand: string;
  • Type: string

The command to use in order to run the projen CLI.


rootRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly root: Project;
  • Type: projen.Project

The root project.


subprojectsRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly subprojects: Project[];
  • Type: projen.Project[]

Returns all the subprojects within this project.


tasksRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly tasks: Tasks;
  • Type: projen.Tasks

Project tasks.


testTaskRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly testTask: Task;
  • Type: projen.Task

defaultTaskOptional ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly defaultTask: Task;
  • Type: projen.Task

This is the "default" task, the one that executes "projen".

Undefined if the project is being ejected.


initProjectOptional ​
  • Deprecated: use the initProject argument passed to Component.projectCreation() instead.
public readonly initProject: InitProject;
  • Type: projen.InitProject

The options used when this project is bootstrapped via projen new.

It includes the original set of options passed to the CLI and also the JSII FQN of the project type.


parentOptional ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly parent: Project;
  • Type: projen.Project

A parent project.

If undefined, this is the root project.


autoApproveOptional ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly autoApprove: AutoApprove;

Auto approve set up for this project.


devContainerOptional ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly devContainer: DevContainer;
  • Type: projen.vscode.DevContainer

Access for .devcontainer.json (used for GitHub Codespaces).

This will be undefined if devContainer boolean is false


githubOptional ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly github: GitHub;

Access all github components.

This will be undefined for subprojects.


gitpodOptional ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly gitpod: Gitpod;
  • Type: projen.Gitpod

Access for Gitpod.

This will be undefined if gitpod boolean is false


vscodeOptional ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly vscode: VsCode;
  • Type: projen.vscode.VsCode

Access all VSCode components.

This will be undefined for subprojects.


Constants ​

NameTypeDescription
DEFAULT_TASK
stringThe name of the default task (the task executed when projen is run without arguments).

DEFAULT_TASKRequired ​
  • Deprecated: This is a temporary class. At the moment, our base project types such as NodeProject and JavaProject are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly DEFAULT_TASK: string;
  • Type: string

The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.


GithubWorkflow ​

Workflow for GitHub.

A workflow is a configurable automated process made up of one or more jobs.

https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions

Initializers ​

import { github } from 'projen'

new github.GithubWorkflow(github: GitHub, name: string, options?: GithubWorkflowOptions)
NameTypeDescription
github
GitHub
The GitHub component of the project this workflow belongs to.
name
stringThe name of the workflow, displayed under the repository's "Actions" tab.
options
GithubWorkflowOptions
Additional options to configure the workflow.

githubRequired ​

The GitHub component of the project this workflow belongs to.


nameRequired ​
  • Type: string

The name of the workflow, displayed under the repository's "Actions" tab.


optionsOptional ​

Additional options to configure the workflow.


Methods ​

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
Synthesizes files to the project output directory.
addJob
Adds a single job to the workflow.
addJobs
Add jobs to the workflow.
appendStep
Appends a step to the end of a job's step list.
getJob
Get a single job from the workflow.
getStep
Gets a single step from a job by step ID.
insertStepAfter
Inserts a step after an existing step, identified by ID.
insertStepBefore
Inserts a step before an existing step, identified by ID.
on
Add events to triggers the workflow.
patchStep
Applies a surgical modification to an existing step.
removeJob
Removes a single job to the workflow.
removeStep
Removes a step from a job by step ID.
replaceStep
Replaces an existing step in a job, preserving its position.
updateJob
Updates a single job to the workflow.
updateJobs
Updates jobs for this workflow Does a complete replace, it does not try to merge the jobs.

toString ​
public toString(): string

Returns a string representation of this construct.

with ​
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired ​
  • Type: ...constructs.IMixin[]

The mixins to apply.


postProjectCreation ​
public postProjectCreation(initProject: InitProject): void

Called once, right after postSynthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST. Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate feedback on their new project. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


postSynthesize ​
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize ​
public preSynthesize(): void

Called before synthesis.

projectCreation ​
public projectCreation(initProject: InitProject): void

Called once, right after synthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). Use it for deterministic, one-off file generation. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


synthesize ​
public synthesize(): void

Synthesizes files to the project output directory.

addJob ​
public addJob(id: string, job: JobCallingReusableWorkflow | Job): void

Adds a single job to the workflow.

idRequired ​
  • Type: string

The job name (unique within the workflow).


jobRequired ​

The job specification.


addJobs ​
public addJobs(jobs: {[ key: string ]: JobCallingReusableWorkflow | Job}): void

Add jobs to the workflow.

jobsRequired ​

Jobs to add.


appendStep ​
public appendStep(jobId: string, step: JobStep): void

Appends a step to the end of a job's step list.

jobIdRequired ​
  • Type: string

The job name (unique within the workflow).


stepRequired ​

The step to add.

Must have an id set.


getJob ​
public getJob(id: string): JobCallingReusableWorkflow | Job

Get a single job from the workflow.

idRequired ​
  • Type: string

The job name (unique within the workflow).


getStep ​
public getStep(jobId: string, stepId: string): JobStep

Gets a single step from a job by step ID.

The returned object is frozen and read-only. Use replaceStep or patchStep to modify a step.

jobIdRequired ​
  • Type: string

The job name (unique within the workflow).


stepIdRequired ​
  • Type: string

The step ID to look up.


insertStepAfter ​
public insertStepAfter(jobId: string, referenceStepId: string, step: JobStep): void

Inserts a step after an existing step, identified by ID.

jobIdRequired ​
  • Type: string

The job name (unique within the workflow).


referenceStepIdRequired ​
  • Type: string

The ID of the step to insert after.


stepRequired ​

The step to insert.

Must have an id set.


insertStepBefore ​
public insertStepBefore(jobId: string, referenceStepId: string, step: JobStep): void

Inserts a step before an existing step, identified by ID.

jobIdRequired ​
  • Type: string

The job name (unique within the workflow).


referenceStepIdRequired ​
  • Type: string

The ID of the step to insert before.


stepRequired ​

The step to insert.

Must have an id set.


on ​
public on(events: Triggers): void

Add events to triggers the workflow.

eventsRequired ​

The event(s) to trigger the workflow.


patchStep ​
public patchStep(jobId: string, stepId: string, patch: JobStep): void

Applies a surgical modification to an existing step.

The provided patch is shallow-merged onto the existing step. Fields not present in the patch are preserved unchanged. Use getStep to read the current step values before constructing the patch.

Example

// Add an env var without replacing existing ones:
const step = workflow.getStep("build", "install");
workflow.patchStep("build", "install", {
env: { ...step.env, NODE_AUTH_TOKEN: "${{ steps.jfrog.outputs.oidc-token }}" },
});
jobIdRequired ​
  • Type: string

The job name (unique within the workflow).


stepIdRequired ​
  • Type: string

The ID of the step to patch.


patchRequired ​

A partial step object whose fields are shallow-merged onto the existing step.


removeJob ​
public removeJob(id: string): void

Removes a single job to the workflow.

idRequired ​
  • Type: string

The job name (unique within the workflow).


removeStep ​
public removeStep(jobId: string, stepId: string): void

Removes a step from a job by step ID.

jobIdRequired ​
  • Type: string

The job name (unique within the workflow).


stepIdRequired ​
  • Type: string

The ID of the step to remove.


replaceStep ​
public replaceStep(jobId: string, stepId: string, replacementStep: JobStep): void

Replaces an existing step in a job, preserving its position.

jobIdRequired ​
  • Type: string

The job name (unique within the workflow).


stepIdRequired ​
  • Type: string

The ID of the step to replace.


replacementStepRequired ​

The replacement step.

Inherits the original step's ID.


updateJob ​
public updateJob(id: string, job: JobCallingReusableWorkflow | Job): void

Updates a single job to the workflow.

idRequired ​
  • Type: string

The job name (unique within the workflow).


jobRequired ​

updateJobs ​
public updateJobs(jobs: {[ key: string ]: JobCallingReusableWorkflow | Job}): void

Updates jobs for this workflow Does a complete replace, it does not try to merge the jobs.

jobsRequired ​

Jobs to update.


Static Functions ​

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct ​
import { github } from 'projen'

github.GithubWorkflow.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired ​
  • Type: any

Any object.


isComponent ​
import { github } from 'projen'

github.GithubWorkflow.isComponent(x: any)

Test whether the given construct is a component.

xRequired ​
  • Type: any

Properties ​

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
jobs
{[ key: string ]: JobCallingReusableWorkflow | Job}
All current jobs of the workflow.
name
stringThe name of the workflow.
projenCredentials
GithubCredentials
GitHub API authentication method used by projen workflows.
concurrency
ConcurrencyOptions
The concurrency configuration of the workflow.
env
{[ key: string ]: string}Additional environment variables to set for the workflow.
file
projen.YamlFileThe workflow YAML file.
runName
stringThe name for workflow runs generated from the workflow.

nodeRequired ​
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired ​
public readonly project: Project;
  • Type: projen.Project

jobsRequired ​
public readonly jobs: {[ key: string ]: JobCallingReusableWorkflow | Job};

All current jobs of the workflow.

This is a read-only copy, use the respective helper methods to add, update or remove jobs.


nameRequired ​
public readonly name: string;
  • Type: string

The name of the workflow.

GitHub displays the names of your workflows under your repository's "Actions" tab.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#name


projenCredentialsRequired ​
public readonly projenCredentials: GithubCredentials;

GitHub API authentication method used by projen workflows.


concurrencyOptional ​
public readonly concurrency: ConcurrencyOptions;

The concurrency configuration of the workflow.

undefined means no concurrency limitations.


envOptional ​
public readonly env: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

Additional environment variables to set for the workflow.


fileOptional ​
public readonly file: YamlFile;
  • Type: projen.YamlFile

The workflow YAML file.

May not exist if workflowsEnabled is false on GitHub.


runNameOptional ​
public readonly runName: string;
  • Type: string

The name for workflow runs generated from the workflow.

GitHub displays the workflow run name in the list of workflow runs on your repository's "Actions" tab. If run-name is omitted or is only whitespace, then the run name is set to event-specific information for the workflow run. For example, for a workflow triggered by a push or pull_request event, it is set as the commit message.

This value can include expressions and can reference github and inputs contexts.


MergeQueue ​

Merge pull requests using a merge queue.

Initializers ​

import { github } from 'projen'

new github.MergeQueue(scope: IConstruct, options?: MergeQueueOptions)
NameTypeDescription
scope
constructs.IConstructNo description.
options
MergeQueueOptions
No description.

scopeRequired ​
  • Type: constructs.IConstruct

optionsOptional ​

Methods ​

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
Synthesizes files to the project output directory.

toString ​
public toString(): string

Returns a string representation of this construct.

with ​
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired ​
  • Type: ...constructs.IMixin[]

The mixins to apply.


postProjectCreation ​
public postProjectCreation(initProject: InitProject): void

Called once, right after postSynthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST. Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate feedback on their new project. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


postSynthesize ​
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize ​
public preSynthesize(): void

Called before synthesis.

projectCreation ​
public projectCreation(initProject: InitProject): void

Called once, right after synthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). Use it for deterministic, one-off file generation. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


synthesize ​
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions ​

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct ​
import { github } from 'projen'

github.MergeQueue.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired ​
  • Type: any

Any object.


isComponent ​
import { github } from 'projen'

github.MergeQueue.isComponent(x: any)

Test whether the given construct is a component.

xRequired ​
  • Type: any

Properties ​

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.

nodeRequired ​
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired ​
public readonly project: Project;
  • Type: projen.Project

Mergify ​

Initializers ​

import { github } from 'projen'

new github.Mergify(github: GitHub, options?: MergifyOptions)
NameTypeDescription
github
GitHub
No description.
options
MergifyOptions
No description.

githubRequired ​

optionsOptional ​

Methods ​

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
Synthesizes files to the project output directory.
addQueue
No description.
addRule
No description.

toString ​
public toString(): string

Returns a string representation of this construct.

with ​
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired ​
  • Type: ...constructs.IMixin[]

The mixins to apply.


postProjectCreation ​
public postProjectCreation(initProject: InitProject): void

Called once, right after postSynthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST. Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate feedback on their new project. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


postSynthesize ​
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize ​
public preSynthesize(): void

Called before synthesis.

projectCreation ​
public projectCreation(initProject: InitProject): void

Called once, right after synthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). Use it for deterministic, one-off file generation. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


synthesize ​
public synthesize(): void

Synthesizes files to the project output directory.

addQueue ​
public addQueue(queue: MergifyQueue): void
queueRequired ​

addRule ​
public addRule(rule: MergifyRule): void
ruleRequired ​

Static Functions ​

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct ​
import { github } from 'projen'

github.Mergify.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired ​
  • Type: any

Any object.


isComponent ​
import { github } from 'projen'

github.Mergify.isComponent(x: any)

Test whether the given construct is a component.

xRequired ​
  • Type: any

Properties ​

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.

nodeRequired ​
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired ​
public readonly project: Project;
  • Type: projen.Project

PullRequestBackport ​

Initializers ​

import { github } from 'projen'

new github.PullRequestBackport(scope: IConstruct, options?: PullRequestBackportOptions)
NameTypeDescription
scope
constructs.IConstructNo description.
options
PullRequestBackportOptions
No description.

scopeRequired ​
  • Type: constructs.IConstruct

optionsOptional ​

Methods ​

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
Synthesizes files to the project output directory.

toString ​
public toString(): string

Returns a string representation of this construct.

with ​
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired ​
  • Type: ...constructs.IMixin[]

The mixins to apply.


postProjectCreation ​
public postProjectCreation(initProject: InitProject): void

Called once, right after postSynthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST. Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate feedback on their new project. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


postSynthesize ​
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize ​
public preSynthesize(): void

Called before synthesis.

projectCreation ​
public projectCreation(initProject: InitProject): void

Called once, right after synthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). Use it for deterministic, one-off file generation. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


synthesize ​
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions ​

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct ​
import { github } from 'projen'

github.PullRequestBackport.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired ​
  • Type: any

Any object.


isComponent ​
import { github } from 'projen'

github.PullRequestBackport.isComponent(x: any)

Test whether the given construct is a component.

xRequired ​
  • Type: any

Properties ​

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
file
projen.JsonFileNo description.
workflow
GithubWorkflow
No description.

nodeRequired ​
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired ​
public readonly project: Project;
  • Type: projen.Project

fileRequired ​
public readonly file: JsonFile;
  • Type: projen.JsonFile

workflowRequired ​
public readonly workflow: GithubWorkflow;

PullRequestLint ​

Configure validations to run on GitHub pull requests.

Only generates a file if at least one linter is configured.

Initializers ​

import { github } from 'projen'

new github.PullRequestLint(github: GitHub, options?: PullRequestLintOptions)
NameTypeDescription
github
GitHub
No description.
options
PullRequestLintOptions
No description.

githubRequired ​

optionsOptional ​

Methods ​

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
Synthesizes files to the project output directory.

toString ​
public toString(): string

Returns a string representation of this construct.

with ​
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired ​
  • Type: ...constructs.IMixin[]

The mixins to apply.


postProjectCreation ​
public postProjectCreation(initProject: InitProject): void

Called once, right after postSynthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST. Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate feedback on their new project. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


postSynthesize ​
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize ​
public preSynthesize(): void

Called before synthesis.

projectCreation ​
public projectCreation(initProject: InitProject): void

Called once, right after synthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). Use it for deterministic, one-off file generation. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


synthesize ​
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions ​

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct ​
import { github } from 'projen'

github.PullRequestLint.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired ​
  • Type: any

Any object.


isComponent ​
import { github } from 'projen'

github.PullRequestLint.isComponent(x: any)

Test whether the given construct is a component.

xRequired ​
  • Type: any

Properties ​

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.

nodeRequired ​
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired ​
public readonly project: Project;
  • Type: projen.Project

PullRequestTemplate ​

Template for GitHub pull requests.

Initializers ​

import { github } from 'projen'

new github.PullRequestTemplate(github: GitHub, options?: PullRequestTemplateOptions)
NameTypeDescription
github
GitHub
No description.
options
PullRequestTemplateOptions
No description.

githubRequired ​

optionsOptional ​

Methods ​

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
Writes the file to the project's output directory.
diff
Returns a unified diff of the old and new file contents with context lines and hunk headers.
addLine
Adds a line to the text file.

toString ​
public toString(): string

Returns a string representation of this construct.

with ​
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired ​
  • Type: ...constructs.IMixin[]

The mixins to apply.


postProjectCreation ​
public postProjectCreation(initProject: InitProject): void

Called once, right after postSynthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST. Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate feedback on their new project. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


postSynthesize ​
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize ​
public preSynthesize(): void

Called before synthesis.

projectCreation ​
public projectCreation(initProject: InitProject): void

Called once, right after synthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). Use it for deterministic, one-off file generation. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


synthesize ​
public synthesize(): void

Writes the file to the project's output directory.

diff ​
public diff(colorize?: boolean, contextLines?: number): string[]

Returns a unified diff of the old and new file contents with context lines and hunk headers.

Only available after synthesis.

This is an expensive operation and should only be used on non time-critical code paths, like debug output.

colorizeOptional ​
  • Type: boolean

Whether to colorize the diff output.


contextLinesOptional ​
  • Type: number

Number of context lines around changes.


addLine ​
public addLine(line: string): void

Adds a line to the text file.

lineRequired ​
  • Type: string

the line to add (can use tokens).


Static Functions ​

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.
of
Returns the PullRequestTemplate instance associated with a project or undefined if there is no PullRequestTemplate.

isConstruct ​
import { github } from 'projen'

github.PullRequestTemplate.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired ​
  • Type: any

Any object.


isComponent ​
import { github } from 'projen'

github.PullRequestTemplate.isComponent(x: any)

Test whether the given construct is a component.

xRequired ​
  • Type: any

of ​
import { github } from 'projen'

github.PullRequestTemplate.of(project: Project)

Returns the PullRequestTemplate instance associated with a project or undefined if there is no PullRequestTemplate.

projectRequired ​
  • Type: projen.Project

The project.


Properties ​

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
absolutePath
stringThe absolute path of this file.
committed
booleanIndicates if the file will be committed.
path
stringThe file path, relative to the project's outdir.
changed
booleanIndicates if the file has been changed during synthesis.
marker
stringThe projen marker, used to identify files as projen-generated.
executable
booleanIndicates if the file should be marked as executable.
readonly
booleanIndicates if the file should be read-only or read-write.

nodeRequired ​
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired ​
public readonly project: Project;
  • Type: projen.Project

absolutePathRequired ​
public readonly absolutePath: string;
  • Type: string

The absolute path of this file.


committedRequired ​
public readonly committed: boolean;
  • Type: boolean

Indicates if the file will be committed.


pathRequired ​
public readonly path: string;
  • Type: string

The file path, relative to the project's outdir.


changedOptional ​
public readonly changed: boolean;
  • Type: boolean

Indicates if the file has been changed during synthesis.

This property is only available in postSynthesize() hooks. If this is undefined, the file has not been synthesized yet.


markerOptional ​
public readonly marker: string;
  • Type: string

The projen marker, used to identify files as projen-generated.

Value is undefined if the project is being ejected.


executableRequired ​
public readonly executable: boolean;
  • Type: boolean

Indicates if the file should be marked as executable.


readonlyRequired ​
public readonly readonly: boolean;
  • Type: boolean

Indicates if the file should be read-only or read-write.


Stale ​

Warns and then closes issues and PRs that have had no activity for a specified amount of time.

The default configuration will:

  • Add a "Stale" label to pull requests after 14 days and closed after 2 days
  • Add a "Stale" label to issues after 60 days and closed after 7 days
  • If a comment is added, the label will be removed and timer is restarted.

https://github.com/actions/stale

Initializers ​

import { github } from 'projen'

new github.Stale(github: GitHub, options?: StaleOptions)
NameTypeDescription
github
GitHub
No description.
options
StaleOptions
No description.

githubRequired ​

optionsOptional ​

Methods ​

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
Synthesizes files to the project output directory.

toString ​
public toString(): string

Returns a string representation of this construct.

with ​
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired ​
  • Type: ...constructs.IMixin[]

The mixins to apply.


postProjectCreation ​
public postProjectCreation(initProject: InitProject): void

Called once, right after postSynthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST. Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate feedback on their new project. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


postSynthesize ​
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize ​
public preSynthesize(): void

Called before synthesis.

projectCreation ​
public projectCreation(initProject: InitProject): void

Called once, right after synthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). Use it for deterministic, one-off file generation. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


synthesize ​
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions ​

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct ​
import { github } from 'projen'

github.Stale.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired ​
  • Type: any

Any object.


isComponent ​
import { github } from 'projen'

github.Stale.isComponent(x: any)

Test whether the given construct is a component.

xRequired ​
  • Type: any

Properties ​

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.

nodeRequired ​
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired ​
public readonly project: Project;
  • Type: projen.Project

TaskWorkflow ​

A GitHub workflow for common build tasks within a project.

Initializers ​

import { github } from 'projen'

new github.TaskWorkflow(github: GitHub, options: TaskWorkflowOptions)
NameTypeDescription
github
GitHub
No description.
options
TaskWorkflowOptions
No description.

githubRequired ​

optionsRequired ​

Methods ​

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
Synthesizes files to the project output directory.
addJob
Adds a single job to the workflow.
addJobs
Add jobs to the workflow.
appendStep
Appends a step to the end of a job's step list.
getJob
Get a single job from the workflow.
getStep
Gets a single step from a job by step ID.
insertStepAfter
Inserts a step after an existing step, identified by ID.
insertStepBefore
Inserts a step before an existing step, identified by ID.
on
Add events to triggers the workflow.
patchStep
Applies a surgical modification to an existing step.
removeJob
Removes a single job to the workflow.
removeStep
Removes a step from a job by step ID.
replaceStep
Replaces an existing step in a job, preserving its position.
updateJob
Updates a single job to the workflow.
updateJobs
Updates jobs for this workflow Does a complete replace, it does not try to merge the jobs.

toString ​
public toString(): string

Returns a string representation of this construct.

with ​
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired ​
  • Type: ...constructs.IMixin[]

The mixins to apply.


postProjectCreation ​
public postProjectCreation(initProject: InitProject): void

Called once, right after postSynthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST. Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate feedback on their new project. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


postSynthesize ​
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize ​
public preSynthesize(): void

Called before synthesis.

projectCreation ​
public projectCreation(initProject: InitProject): void

Called once, right after synthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). Use it for deterministic, one-off file generation. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


synthesize ​
public synthesize(): void

Synthesizes files to the project output directory.

addJob ​
public addJob(id: string, job: JobCallingReusableWorkflow | Job): void

Adds a single job to the workflow.

idRequired ​
  • Type: string

The job name (unique within the workflow).


jobRequired ​

The job specification.


addJobs ​
public addJobs(jobs: {[ key: string ]: JobCallingReusableWorkflow | Job}): void

Add jobs to the workflow.

jobsRequired ​

Jobs to add.


appendStep ​
public appendStep(jobId: string, step: JobStep): void

Appends a step to the end of a job's step list.

jobIdRequired ​
  • Type: string

The job name (unique within the workflow).


stepRequired ​

The step to add.

Must have an id set.


getJob ​
public getJob(id: string): JobCallingReusableWorkflow | Job

Get a single job from the workflow.

idRequired ​
  • Type: string

The job name (unique within the workflow).


getStep ​
public getStep(jobId: string, stepId: string): JobStep

Gets a single step from a job by step ID.

The returned object is frozen and read-only. Use replaceStep or patchStep to modify a step.

jobIdRequired ​
  • Type: string

The job name (unique within the workflow).


stepIdRequired ​
  • Type: string

The step ID to look up.


insertStepAfter ​
public insertStepAfter(jobId: string, referenceStepId: string, step: JobStep): void

Inserts a step after an existing step, identified by ID.

jobIdRequired ​
  • Type: string

The job name (unique within the workflow).


referenceStepIdRequired ​
  • Type: string

The ID of the step to insert after.


stepRequired ​

The step to insert.

Must have an id set.


insertStepBefore ​
public insertStepBefore(jobId: string, referenceStepId: string, step: JobStep): void

Inserts a step before an existing step, identified by ID.

jobIdRequired ​
  • Type: string

The job name (unique within the workflow).


referenceStepIdRequired ​
  • Type: string

The ID of the step to insert before.


stepRequired ​

The step to insert.

Must have an id set.


on ​
public on(events: Triggers): void

Add events to triggers the workflow.

eventsRequired ​

The event(s) to trigger the workflow.


patchStep ​
public patchStep(jobId: string, stepId: string, patch: JobStep): void

Applies a surgical modification to an existing step.

The provided patch is shallow-merged onto the existing step. Fields not present in the patch are preserved unchanged. Use getStep to read the current step values before constructing the patch.

Example

// Add an env var without replacing existing ones:
const step = workflow.getStep("build", "install");
workflow.patchStep("build", "install", {
env: { ...step.env, NODE_AUTH_TOKEN: "${{ steps.jfrog.outputs.oidc-token }}" },
});
jobIdRequired ​
  • Type: string

The job name (unique within the workflow).


stepIdRequired ​
  • Type: string

The ID of the step to patch.


patchRequired ​

A partial step object whose fields are shallow-merged onto the existing step.


removeJob ​
public removeJob(id: string): void

Removes a single job to the workflow.

idRequired ​
  • Type: string

The job name (unique within the workflow).


removeStep ​
public removeStep(jobId: string, stepId: string): void

Removes a step from a job by step ID.

jobIdRequired ​
  • Type: string

The job name (unique within the workflow).


stepIdRequired ​
  • Type: string

The ID of the step to remove.


replaceStep ​
public replaceStep(jobId: string, stepId: string, replacementStep: JobStep): void

Replaces an existing step in a job, preserving its position.

jobIdRequired ​
  • Type: string

The job name (unique within the workflow).


stepIdRequired ​
  • Type: string

The ID of the step to replace.


replacementStepRequired ​

The replacement step.

Inherits the original step's ID.


updateJob ​
public updateJob(id: string, job: JobCallingReusableWorkflow | Job): void

Updates a single job to the workflow.

idRequired ​
  • Type: string

The job name (unique within the workflow).


jobRequired ​

updateJobs ​
public updateJobs(jobs: {[ key: string ]: JobCallingReusableWorkflow | Job}): void

Updates jobs for this workflow Does a complete replace, it does not try to merge the jobs.

jobsRequired ​

Jobs to update.


Static Functions ​

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct ​
import { github } from 'projen'

github.TaskWorkflow.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired ​
  • Type: any

Any object.


isComponent ​
import { github } from 'projen'

github.TaskWorkflow.isComponent(x: any)

Test whether the given construct is a component.

xRequired ​
  • Type: any

Properties ​

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
jobs
{[ key: string ]: JobCallingReusableWorkflow | Job}
All current jobs of the workflow.
name
stringThe name of the workflow.
projenCredentials
GithubCredentials
GitHub API authentication method used by projen workflows.
concurrency
ConcurrencyOptions
The concurrency configuration of the workflow.
env
{[ key: string ]: string}Additional environment variables to set for the workflow.
file
projen.YamlFileThe workflow YAML file.
runName
stringThe name for workflow runs generated from the workflow.
jobId
stringNo description.
artifactsDirectory
stringNo description.

nodeRequired ​
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired ​
public readonly project: Project;
  • Type: projen.Project

jobsRequired ​
public readonly jobs: {[ key: string ]: JobCallingReusableWorkflow | Job};

All current jobs of the workflow.

This is a read-only copy, use the respective helper methods to add, update or remove jobs.


nameRequired ​
public readonly name: string;
  • Type: string

The name of the workflow.

GitHub displays the names of your workflows under your repository's "Actions" tab.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#name


projenCredentialsRequired ​
public readonly projenCredentials: GithubCredentials;

GitHub API authentication method used by projen workflows.


concurrencyOptional ​
public readonly concurrency: ConcurrencyOptions;

The concurrency configuration of the workflow.

undefined means no concurrency limitations.


envOptional ​
public readonly env: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

Additional environment variables to set for the workflow.


fileOptional ​
public readonly file: YamlFile;
  • Type: projen.YamlFile

The workflow YAML file.

May not exist if workflowsEnabled is false on GitHub.


runNameOptional ​
public readonly runName: string;
  • Type: string

The name for workflow runs generated from the workflow.

GitHub displays the workflow run name in the list of workflow runs on your repository's "Actions" tab. If run-name is omitted or is only whitespace, then the run name is set to event-specific information for the workflow run. For example, for a workflow triggered by a push or pull_request event, it is set as the commit message.

This value can include expressions and can reference github and inputs contexts.


jobIdRequired ​
public readonly jobId: string;
  • Type: string

artifactsDirectoryOptional ​
public readonly artifactsDirectory: string;
  • Type: string

TaskWorkflowJob ​

The primary or initial job of a TaskWorkflow.

Initializers ​

import { github } from 'projen'

new github.TaskWorkflowJob(scope: IConstruct, task: Task, options: TaskWorkflowJobOptions)
NameTypeDescription
scope
constructs.IConstructshould be part of the project the Task belongs to.
task
projen.Taskthe main task that is run as part of this job.
options
TaskWorkflowJobOptions
options to configure the TaskWorkflowJob.

scopeRequired ​
  • Type: constructs.IConstruct

should be part of the project the Task belongs to.


taskRequired ​
  • Type: projen.Task

the main task that is run as part of this job.


optionsRequired ​

options to configure the TaskWorkflowJob.


Methods ​

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
Synthesizes files to the project output directory.

toString ​
public toString(): string

Returns a string representation of this construct.

with ​
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired ​
  • Type: ...constructs.IMixin[]

The mixins to apply.


postProjectCreation ​
public postProjectCreation(initProject: InitProject): void

Called once, right after postSynthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST. Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate feedback on their new project. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


postSynthesize ​
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize ​
public preSynthesize(): void

Called before synthesis.

projectCreation ​
public projectCreation(initProject: InitProject): void

Called once, right after synthesize(), only when the project is created for the first time.

It does not run on later projen invocations. It only fires for projen new (or Projects.createProject). Use it for deterministic, one-off file generation. Order across components is not guaranteed.

initProjectRequired ​
  • Type: projen.InitProject

Details about how the project was created, e.g. its type and the original CLI args.


synthesize ​
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions ​

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct ​
import { github } from 'projen'

github.TaskWorkflowJob.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired ​
  • Type: any

Any object.


isComponent ​
import { github } from 'projen'

github.TaskWorkflowJob.isComponent(x: any)

Test whether the given construct is a component.

xRequired ​
  • Type: any

Properties ​

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
permissions
JobPermissions
No description.
steps
JobStep[]
No description.
concurrency
anyNo description.
container
ContainerOptions
No description.
continueOnError
booleanNo description.
defaults
JobDefaults
No description.
env
{[ key: string ]: string}No description.
environment
stringNo description.
if
stringNo description.
name
stringNo description.
needs
string[]No description.
outputs
{[ key: string ]: JobStepOutput}
No description.
runsOn
string[]No description.
runsOnGroup
projen.GroupRunnerOptionsNo description.
services
{[ key: string ]: ContainerOptions}
No description.
strategy
JobStrategy
No description.
timeoutMinutes
numberNo description.
tools
Tools
No description.

nodeRequired ​
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired ​
public readonly project: Project;
  • Type: projen.Project

permissionsRequired ​
public readonly permissions: JobPermissions;

stepsRequired ​
public readonly steps: JobStep[];

concurrencyOptional ​
public readonly concurrency: any;
  • Type: any

containerOptional ​
public readonly container: ContainerOptions;

continueOnErrorOptional ​
public readonly continueOnError: boolean;
  • Type: boolean

defaultsOptional ​
public readonly defaults: JobDefaults;

envOptional ​
public readonly env: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

environmentOptional ​
public readonly environment: string;
  • Type: string

ifOptional ​
public readonly if: string;
  • Type: string

nameOptional ​
public readonly name: string;
  • Type: string

needsOptional ​
public readonly needs: string[];
  • Type: string[]

outputsOptional ​
public readonly outputs: {[ key: string ]: JobStepOutput};

runsOnOptional ​
public readonly runsOn: string[];
  • Type: string[]

runsOnGroupOptional ​
public readonly runsOnGroup: GroupRunnerOptions;
  • Type: projen.GroupRunnerOptions

servicesOptional ​
public readonly services: {[ key: string ]: ContainerOptions};

strategyOptional ​
public readonly strategy: JobStrategy;

timeoutMinutesOptional ​
public readonly timeoutMinutes: number;
  • Type: number

toolsOptional ​
public readonly tools: Tools;

Structs ​

AutoApproveOptions ​

Options for 'AutoApprove'.

Initializer ​

import { github } from 'projen'

const autoApproveOptions: github.AutoApproveOptions = { ... }

Properties ​

NameTypeDescription
runsOn
string[]Github Runner selection labels.
runsOnGroup
projen.GroupRunnerOptionsGithub Runner Group selection options.
allowedUsernames
string[]Only pull requests authored by these Github usernames will be auto-approved.
credentials
GithubCredentials
The credentials used to approve pull requests.
label
stringOnly pull requests with this label will be auto-approved.
secret
stringA GitHub secret name which contains a GitHub Access Token with write permissions for the pull_request scope.
sources
PullRequestSource[]
Only pull requests from one of these sources will be auto-approved.

runsOnOptional ​
public readonly runsOn: string[];
  • Type: string[]
  • Default: ["ubuntu-latest"]

Github Runner selection labels.


runsOnGroupOptional ​
public readonly runsOnGroup: GroupRunnerOptions;
  • Type: projen.GroupRunnerOptions

Github Runner Group selection options.


allowedUsernamesOptional ​
  • Deprecated: Use sources with PullRequestSource.fromUsers({ logins }) instead.
public readonly allowedUsernames: string[];
  • Type: string[]
  • Default: ['github-actions[bot]']

Only pull requests authored by these Github usernames will be auto-approved.

An empty list approves pull requests from any user.


credentialsOptional ​
public readonly credentials: GithubCredentials;

The credentials used to approve pull requests.

Github forbids an identity to approve its own pull request. These credentials must belong to a different identity than the one creating the pull requests. Use environment on the credentials to restrict which branches can access them.


labelOptional ​
public readonly label: string;
  • Type: string
  • Default: 'auto-approve'

Only pull requests with this label will be auto-approved.

This is required in addition to matching one of the sources.


secretOptional ​
  • Deprecated: Use credentials with GithubCredentials.fromPersonalAccessToken({ secret }) instead.
public readonly secret: string;
  • Type: string
  • Default: "GITHUB_TOKEN"

A GitHub secret name which contains a GitHub Access Token with write permissions for the pull_request scope.

This token is used to approve pull requests.

Github forbids an identity to approve its own pull request. If your project produces automated pull requests using the Github default token - {@link https://docs.github.com/en/actions/reference/authentication-in-a-workflow GITHUB_TOKEN }

  • that you would like auto approved, such as when using the depsUpgrade property in NodeProjectOptions, then you must use a different token here.

sourcesOptional ​
public readonly sources: PullRequestSource[];
  • Type: PullRequestSource[]
  • Default: [PullRequestSource.fromUsers({ logins: ["github-actions[bot]"] })]

Only pull requests from one of these sources will be auto-approved.

Components that create pull requests can add more sources with AutoApprove.addSource(). Providing sources, either here or with addSource(), replaces the default source.


AutoMergeOptions ​

Initializer ​

import { github } from 'projen'

const autoMergeOptions: github.AutoMergeOptions = { ... }

Properties ​

NameTypeDescription
approvedReviews
numberNumber of approved code reviews.
blockingLabels
string[]List of labels that will prevent auto-merging.
queueName
stringName of the mergify queue.
ruleName
stringName of the mergify rule.

approvedReviewsOptional ​
public readonly approvedReviews: number;
  • Type: number
  • Default: 1

Number of approved code reviews.


blockingLabelsOptional ​
public readonly blockingLabels: string[];
  • Type: string[]
  • Default: ['do-not-merge']

List of labels that will prevent auto-merging.


queueNameOptional ​
public readonly queueName: string;
  • Type: string
  • Default: 'default'

Name of the mergify queue.


ruleNameOptional ​
public readonly ruleName: string;
  • Type: string
  • Default: 'Automatic merge on approval and successful build'

Name of the mergify rule.


AutoQueueOptions ​

Options for 'AutoQueue'.

Initializer ​

import { github } from 'projen'

const autoQueueOptions: github.AutoQueueOptions = { ... }

Properties ​

NameTypeDescription
runsOn
string[]Github Runner selection labels.
runsOnGroup
projen.GroupRunnerOptionsGithub Runner Group selection options.
allowedUsernames
string[]Only pull requests authored by these Github usernames will have auto-queue enabled.
labels
string[]Only pull requests with one of this labels will have auto-queue enabled.
mergeMethod
MergeMethod
The method used to add the PR to the merge queue Any branch protection rules must allow this merge method.
projenCredentials
GithubCredentials
Choose a method for authenticating with GitHub to enable auto-queue on pull requests.
targetBranches
string[]The branch names that we should auto-queue for.

runsOnOptional ​
public readonly runsOn: string[];
  • Type: string[]
  • Default: ["ubuntu-latest"]

Github Runner selection labels.


runsOnGroupOptional ​
public readonly runsOnGroup: GroupRunnerOptions;
  • Type: projen.GroupRunnerOptions

Github Runner Group selection options.


allowedUsernamesOptional ​
public readonly allowedUsernames: string[];
  • Type: string[]
  • Default: pull requests from all users are eligible for auto-queuing

Only pull requests authored by these Github usernames will have auto-queue enabled.


labelsOptional ​
public readonly labels: string[];
  • Type: string[]
  • Default: all pull requests are eligible for auto-queueing

Only pull requests with one of this labels will have auto-queue enabled.


mergeMethodOptional ​
public readonly mergeMethod: MergeMethod;

The method used to add the PR to the merge queue Any branch protection rules must allow this merge method.


projenCredentialsOptional ​
public readonly projenCredentials: GithubCredentials;

Choose a method for authenticating with GitHub to enable auto-queue on pull requests.

The workflow cannot use a default github token. Queuing a PR with the default token will not trigger any merge queue workflows, which results in the PR just not getting merged at all.

https://projen.io/docs/integrations/github/


targetBranchesOptional ​
public readonly targetBranches: string[];
  • Type: string[]

The branch names that we should auto-queue for.

This set of branches should be a subset of MergeQueueOptions.targetBranches.

Be sure not to enable autoQueue for branches that don't have branch rules with merge requirements set up, otherwise new PRs will be merged immediately after creating without a chance for review.

Automatically merging a set of Stacked PRs​

If you set this to ['main'] you can automatically merge a set of Stacked PRs in the right order. It works like this:

  • Create PR #1 from branch a, targeting main.
  • Create PR #2 from branch b, targeting branch a.
  • Create PR #3 from branch c, targeting branch b.

Initially, PR #1 will be set to auto-merge, PRs #2 and #3 will not.

Once PR #1 passes all of its requirements it will merge. That will delete branch a and change the target branch of PR #2 change to main. At that point, auto-queueing will switch on for PR #2 and it gets merged, etc.

[!IMPORTANT] This component will never disable AutoMerge, only enable it. So if a PR is initially targeted at one of the branches in this list, and then subsequently retargeted to another branch, AutoMerge is not automatically turned off.


CheckoutOptions ​

Initializer ​

import { github } from 'projen'

const checkoutOptions: github.CheckoutOptions = { ... }

Properties ​

NameTypeDescription
env
{[ key: string ]: string}Sets environment variables for steps to use in the runner environment.
id
stringA unique identifier for the step.
if
stringYou can use the if conditional to prevent a job from running unless a condition is met.
name
stringA name for your step to display on GitHub.
shell
stringOverrides the default shell settings in the runner's operating system and the job's default.
workingDirectory
stringSpecifies a working directory for a step.
background
booleanRuns a step asynchronously so the job continues to the next step without waiting for it to finish.
cancel
stringGracefully terminates a running background step, referenced by its id.
continueOnError
booleanPrevents a job from failing when a step fails.
parallel
JobStep[]
Runs a group of steps concurrently, then waits for all of them to finish before continuing.
timeoutMinutes
numberThe maximum number of minutes to run the step before killing the process.
wait
string[]Pauses the job until one or more background steps complete. Provide the ids of the background steps to wait for.
waitAll
booleanPauses the job until all active background steps complete.
with
CheckoutWith
Options for checkout.

envOptional ​
public readonly env: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

Sets environment variables for steps to use in the runner environment.

You can also set environment variables for the entire workflow or a job.


idOptional ​
public readonly id: string;
  • Type: string

A unique identifier for the step.

You can use the id to reference the step in contexts.


ifOptional ​
public readonly if: string;
  • Type: string

You can use the 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.


nameOptional ​
public readonly name: string;
  • Type: string

A name for your step to display on GitHub.


shellOptional ​
public readonly shell: string;
  • Type: string

Overrides the default shell settings in the runner's operating system and the job's default.

Refer to GitHub documentation for allowed values.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell


workingDirectoryOptional ​
public readonly workingDirectory: string;
  • Type: string

Specifies a working directory for a step.

Overrides a job's working directory.


backgroundOptional ​
public readonly background: boolean;
  • Type: boolean

Runs a step asynchronously so the job continues to the next step without waiting for it to finish.

Use for long-running processes, such as databases, servers, or monitoring tasks, that need to run alongside other steps.

Synchronize with background steps later using wait or waitAll, or stop them with cancel. Give the step an id so it can be referenced.

A maximum of 10 background steps can run concurrently in a single job; additional background steps are queued until a slot is free.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsbackground


cancelOptional ​
public readonly cancel: string;
  • Type: string

Gracefully terminates a running background step, referenced by its id.

The runner sends the step's process a termination signal (SIGTERM) so it can clean up, and forcibly stops it (SIGKILL) if it does not exit within a short grace period.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepscancel


continueOnErrorOptional ​
public readonly continueOnError: boolean;
  • Type: boolean

Prevents a job from failing when a step fails.

Set to true to allow a job to pass when this step fails.


parallelOptional ​
public readonly parallel: JobStep[];

Runs a group of steps concurrently, then waits for all of them to finish before continuing.

This is shorthand for declaring each step with background: true followed by a wait step.

Use this when you have a self-contained group of independent steps that can all run at the same time and don't need to be referenced individually. Use background instead when you need finer control, such as starting a long-running process that stays up while later steps run.

Each step in the group is subject to the same 10-step concurrency limit as other background steps. Cannot be used inside a composite action.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsparallel


timeoutMinutesOptional ​
public readonly timeoutMinutes: number;
  • Type: number

The maximum number of minutes to run the step before killing the process.


waitOptional ​
public readonly wait: string[];
  • Type: string[]

Pauses the job until one or more background steps complete. Provide the ids of the background steps to wait for.

This step performs no work itself; it only blocks until the referenced background steps finish. If a referenced background step failed, the wait step fails too.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswait


waitAllOptional ​
public readonly waitAll: boolean;
  • Type: boolean

Pauses the job until all active background steps complete.

Fails if any of the background steps it waits on failed, unless continueOnError is set on this step.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswait-all


withOptional ​
public readonly with: CheckoutWith;

Options for checkout.


CheckoutWith ​

Options for checkout.

Initializer ​

import { github } from 'projen'

const checkoutWith: github.CheckoutWith = { ... }

Properties ​

NameTypeDescription
fetchDepth
numberNumber of commits to fetch.
lfs
booleanWhether LFS is enabled for the GitHub repository.
path
stringRelative path under $GITHUB_WORKSPACE to place the repository.
ref
stringBranch or tag name.
repository
stringThe repository (owner/repo) to use.
submodules
CheckoutSubmodules
Whether to checkout Git submodules.
token
stringA GitHub token to use when checking out the repository.

fetchDepthOptional ​
public readonly fetchDepth: number;
  • Type: number
  • Default: 1

Number of commits to fetch.

0 indicates all history for all branches and tags.


lfsOptional ​
public readonly lfs: boolean;
  • Type: boolean
  • Default: false

Whether LFS is enabled for the GitHub repository.


pathOptional ​
public readonly path: string;
  • Type: string
  • Default: $GITHUB_WORKSPACE

Relative path under $GITHUB_WORKSPACE to place the repository.


refOptional ​
public readonly ref: string;
  • Type: string
  • Default: the default branch is implicitly used

Branch or tag name.


repositoryOptional ​
public readonly repository: string;
  • Type: string
  • Default: the default repository is implicitly used

The repository (owner/repo) to use.


submodulesOptional ​
public readonly submodules: CheckoutSubmodules;

Whether to checkout Git submodules.


tokenOptional ​
public readonly token: string;
  • Type: string
  • Default: the default GITHUB_TOKEN is implicitly used

A GitHub token to use when checking out the repository.

If the intent is to push changes back to the branch, then you must use a PAT with repo (and possibly workflows) permissions.


CheckoutWithPatchOptions ​

Options for checkoutWithPatch.

Initializer ​

import { github } from 'projen'

const checkoutWithPatchOptions: github.CheckoutWithPatchOptions = { ... }

Properties ​

NameTypeDescription
fetchDepth
numberNumber of commits to fetch.
lfs
booleanWhether LFS is enabled for the GitHub repository.
path
stringRelative path under $GITHUB_WORKSPACE to place the repository.
ref
stringBranch or tag name.
repository
stringThe repository (owner/repo) to use.
submodules
CheckoutSubmodules
Whether to checkout Git submodules.
token
stringA GitHub token to use when checking out the repository.
patchFile
stringThe name of the artifact the patch is stored as.

fetchDepthOptional ​
public readonly fetchDepth: number;
  • Type: number
  • Default: 1

Number of commits to fetch.

0 indicates all history for all branches and tags.


lfsOptional ​
public readonly lfs: boolean;
  • Type: boolean
  • Default: false

Whether LFS is enabled for the GitHub repository.


pathOptional ​
public readonly path: string;
  • Type: string
  • Default: $GITHUB_WORKSPACE

Relative path under $GITHUB_WORKSPACE to place the repository.


refOptional ​
public readonly ref: string;
  • Type: string
  • Default: the default branch is implicitly used

Branch or tag name.


repositoryOptional ​
public readonly repository: string;
  • Type: string
  • Default: the default repository is implicitly used

The repository (owner/repo) to use.


submodulesOptional ​
public readonly submodules: CheckoutSubmodules;

Whether to checkout Git submodules.


tokenOptional ​
public readonly token: string;
  • Type: string
  • Default: the default GITHUB_TOKEN is implicitly used

A GitHub token to use when checking out the repository.

If the intent is to push changes back to the branch, then you must use a PAT with repo (and possibly workflows) permissions.


patchFileOptional ​
public readonly patchFile: string;
  • Type: string
  • Default: ".repo.patch"

The name of the artifact the patch is stored as.


ConcurrencyOptions ​

Options for concurrency.

Initializer ​

import { github } from 'projen'

const concurrencyOptions: github.ConcurrencyOptions = { ... }

Properties ​

NameTypeDescription
cancelInProgress
booleanWhen a workflow is triggered while another one (in the same group) is running, should GitHub cancel the running workflow?
group
stringConcurrency group controls which workflow runs will share the same concurrency limit.

cancelInProgressOptional ​
public readonly cancelInProgress: boolean;
  • Type: boolean
  • Default: false

When a workflow is triggered while another one (in the same group) is running, should GitHub cancel the running workflow?


groupOptional ​
public readonly group: string;
  • Type: string
  • Default: ${{ github.workflow }}

Concurrency group controls which workflow runs will share the same concurrency limit.

For example, if you specify ${{ github.workflow }}-${{ github.ref }}, workflow runs triggered on the same branch cannot run concurrently, but workflows runs triggered on different branches can.

https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/using-concurrency#example-concurrency-groups


ContributorStatementOptions ​

Options for requiring a contributor statement on Pull Requests.

Initializer ​

import { github } from 'projen'

const contributorStatementOptions: github.ContributorStatementOptions = { ... }

Properties ​

NameTypeDescription
exemptLabels
string[]Pull requests with one of these labels are exempted from a contributor statement.
exemptUsers
string[]Pull requests from these GitHub users are exempted from a contributor statement.

exemptLabelsOptional ​
public readonly exemptLabels: string[];
  • Type: string[]
  • Default: no labels are excluded

Pull requests with one of these labels are exempted from a contributor statement.


exemptUsersOptional ​
public readonly exemptUsers: string[];
  • Type: string[]
  • Default: no users are exempted

Pull requests from these GitHub users are exempted from a contributor statement.


CreatePullRequestOptions ​

Initializer ​

import { github } from 'projen'

const createPullRequestOptions: github.CreatePullRequestOptions = { ... }

Properties ​

NameTypeDescription
pullRequestDescription
stringDescription added to the pull request.
pullRequestTitle
stringThe full title used to create the pull request.
workflowName
stringThe name of the workflow that will create the PR.
addPaths
string[]Paths to add to the commit, mapping to the action's add-paths input.
assignees
string[]Assignees to add on the PR.
baseBranch
stringSets the pull request base branch.
branchName
stringThe pull request branch name.
credentials
GithubCredentials
The job credentials used to create the pull request.
deleteBranch
booleanWhether to delete the pull request branch when the pull request is closed, mapping to the action's delete-branch input.
gitIdentity
GitIdentity
The git identity used to create the commit.
labels
string[]Labels to apply on the PR.
signoff
booleanAdd Signed-off-by line by the committer at the end of the commit log message.
stepId
stringThe step ID which produces the output which indicates if a patch was created.
stepName
stringThe name of the step displayed on GitHub.

pullRequestDescriptionRequired ​
public readonly pullRequestDescription: string;
  • Type: string

Description added to the pull request.

Providence information are automatically added.


pullRequestTitleRequired ​
public readonly pullRequestTitle: string;
  • Type: string

The full title used to create the pull request.

If PR titles are validated in this repo, the title should comply with the respective rules.


workflowNameRequired ​
public readonly workflowName: string;
  • Type: string

The name of the workflow that will create the PR.


addPathsOptional ​
public readonly addPaths: string[];
  • Type: string[]
  • Default: all paths

Paths to add to the commit, mapping to the action's add-paths input.


assigneesOptional ​
public readonly assignees: string[];
  • Type: string[]
  • Default: no assignees

Assignees to add on the PR.


baseBranchOptional ​
public readonly baseBranch: string;
  • Type: string
  • Default: The branch checked out in the workflow.

Sets the pull request base branch.


branchNameOptional ​
public readonly branchName: string;
  • Type: string
  • Default: github-actions/${options.workflowName}

The pull request branch name.


credentialsOptional ​
public readonly credentials: GithubCredentials;

The job credentials used to create the pull request.

Provided credentials must have permissions to create a pull request on the repository.


deleteBranchOptional ​
public readonly deleteBranch: boolean;
  • Type: boolean
  • Default: false

Whether to delete the pull request branch when the pull request is closed, mapping to the action's delete-branch input.


gitIdentityOptional ​
public readonly gitIdentity: GitIdentity;
  • Type: GitIdentity
  • Default: default GitHub Actions user

The git identity used to create the commit.


labelsOptional ​
public readonly labels: string[];
  • Type: string[]
  • Default: no labels.

Labels to apply on the PR.


signoffOptional ​
public readonly signoff: boolean;
  • Type: boolean
  • Default: true

Add Signed-off-by line by the committer at the end of the commit log message.


stepIdOptional ​
public readonly stepId: string;
  • Type: string
  • Default: "create_pr"

The step ID which produces the output which indicates if a patch was created.


stepNameOptional ​
public readonly stepName: string;
  • Type: string
  • Default: "Create Pull Request"

The name of the step displayed on GitHub.


DependabotAllow ​

You can use the allow option to customize which dependencies are updated.

The allow option supports the following options.

Initializer ​

import { github } from 'projen'

const dependabotAllow: github.DependabotAllow = { ... }

Properties ​

NameTypeDescription
dependencyName
stringUse to allow updates for dependencies with matching names, optionally using * to match zero or more characters.

dependencyNameRequired ​
public readonly dependencyName: string;
  • Type: string

Use to allow updates for dependencies with matching names, optionally using * to match zero or more characters.

For Java dependencies, the format of the dependency-name attribute is: groupId:artifactId, for example: org.kohsuke:github-api.


DependabotCooldown ​

Defines a cooldown period for dependency version updates.

https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#cooldown-

Initializer ​

import { github } from 'projen'

const dependabotCooldown: github.DependabotCooldown = { ... }

Properties ​

NameTypeDescription
defaultDays
numberDefault cooldown period (in days) for all dependencies without specific semver rules.
exclude
string[]List of dependencies excluded from cooldown.
include
string[]List of dependencies to apply cooldown to.
semverMajorDays
numberCooldown period (in days) for major version updates.
semverMinorDays
numberCooldown period (in days) for minor version updates.
semverPatchDays
numberCooldown period (in days) for patch version updates.

defaultDaysOptional ​
public readonly defaultDays: number;
  • Type: number
  • Default: no default cooldown

Default cooldown period (in days) for all dependencies without specific semver rules.


excludeOptional ​
public readonly exclude: string[];
  • Type: string[]
  • Default: no exclusions

List of dependencies excluded from cooldown.

Supports wildcards. Takes precedence over include.


includeOptional ​
public readonly include: string[];
  • Type: string[]
  • Default: all dependencies

List of dependencies to apply cooldown to.

Supports wildcards.


semverMajorDaysOptional ​
public readonly semverMajorDays: number;
  • Type: number
  • Default: uses defaultDays

Cooldown period (in days) for major version updates.


semverMinorDaysOptional ​
public readonly semverMinorDays: number;
  • Type: number
  • Default: uses defaultDays

Cooldown period (in days) for minor version updates.


semverPatchDaysOptional ​
public readonly semverPatchDays: number;
  • Type: number
  • Default: uses defaultDays

Cooldown period (in days) for patch version updates.


DependabotGroup ​

Defines a single group for dependency updates.

https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference#groups--

Initializer ​

import { github } from 'projen'

const dependabotGroup: github.DependabotGroup = { ... }

Properties ​

NameTypeDescription
patterns
string[]Define a list of strings (with or without wildcards) that will match package names to form this dependency group.
appliesTo
DependabotGroupAppliesTo
Specify which type of update the group applies to.
dependencyType
DependabotGroupDependencyType
Limit the group to a type of dependency.
excludePatterns
string[]Optionally you can use this to exclude certain dependencies from the group.
updateTypes
DependabotGroupUpdateType[]
Limit the group to one or more semantic versioning levels.

patternsRequired ​
public readonly patterns: string[];
  • Type: string[]

Define a list of strings (with or without wildcards) that will match package names to form this dependency group.


appliesToOptional ​
public readonly appliesTo: DependabotGroupAppliesTo;

Specify which type of update the group applies to.


dependencyTypeOptional ​
public readonly dependencyType: DependabotGroupDependencyType;

Limit the group to a type of dependency.

https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference#dependency-type-groups


excludePatternsOptional ​
public readonly excludePatterns: string[];
  • Type: string[]

Optionally you can use this to exclude certain dependencies from the group.


updateTypesOptional ​
public readonly updateTypes: DependabotGroupUpdateType[];

Limit the group to one or more semantic versioning levels.

If specified, must contain at least one element and elements must be unique.

https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference#update-types-groups


DependabotIgnore ​

You can use the ignore option to customize which dependencies are updated.

The ignore option supports the following options.

Initializer ​

import { github } from 'projen'

const dependabotIgnore: github.DependabotIgnore = { ... }

Properties ​

NameTypeDescription
dependencyName
stringUse to ignore updates for dependencies with matching names, optionally using * to match zero or more characters.
versions
string[]Use to ignore specific versions or ranges of versions.

dependencyNameRequired ​
public readonly dependencyName: string;
  • Type: string

Use to ignore updates for dependencies with matching names, optionally using * to match zero or more characters.

For Java dependencies, the format of the dependency-name attribute is: groupId:artifactId, for example: org.kohsuke:github-api.


versionsOptional ​
public readonly versions: string[];
  • Type: string[]

Use to ignore specific versions or ranges of versions.

If you want to define a range, use the standard pattern for the package manager (for example: ^1.0.0 for npm, or ~> 2.0 for Bundler).


DependabotOptions ​

Initializer ​

import { github } from 'projen'

const dependabotOptions: github.DependabotOptions = { ... }

Properties ​

NameTypeDescription
allow
DependabotAllow[]
https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#allow.
assignees
string[]Specify individual assignees or teams of assignees for all pull requests raised for a package manager.
cooldown
DependabotCooldown
Defines a cooldown period for dependency version updates.
groups
{[ key: string ]: DependabotGroup}
https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#groups.
ignore
DependabotIgnore[]
You can use the ignore option to customize which dependencies are updated.
ignoreProjen
booleanIgnores updates to projen.
labels
string[]List of labels to apply to the created PR's.
openPullRequestsLimit
numberSets the maximum of pull requests Dependabot opens for version updates.
registries
{[ key: string ]: DependabotRegistry}
Map of package registries to use.
reviewers
string[]Specify individual reviewers or teams of reviewers for all pull requests raised for a package manager.
scheduleInterval
DependabotScheduleInterval
How often to check for new versions and raise pull requests.
targetBranch
stringhttps://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#target-branch You can configure the target branch for raising pull requests for version updates against.
versioningStrategy
VersioningStrategy
The strategy to use when edits manifest and lock files.

allowOptional ​
public readonly allow: DependabotAllow[];

https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#allow.

Use the allow option to customize which dependencies are updated. This applies to both version and security updates.


assigneesOptional ​
public readonly assignees: string[];
  • Type: string[]
  • Default: []

Specify individual assignees or teams of assignees for all pull requests raised for a package manager.


cooldownOptional ​
public readonly cooldown: DependabotCooldown;

Defines a cooldown period for dependency version updates.

During the cooldown, Dependabot will not propose updates for a dependency. This only applies to version updates, not security updates.

https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#cooldown-


groupsOptional ​
public readonly groups: {[ key: string ]: DependabotGroup};

https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#groups.

You can create groups to package dependency updates together into a single PR.


ignoreOptional ​
public readonly ignore: DependabotIgnore[];

You can use the ignore option to customize which dependencies are updated.

The ignore option supports the following options.


ignoreProjenOptional ​
public readonly ignoreProjen: boolean;
  • Type: boolean
  • Default: true

Ignores updates to projen.

This is required since projen updates may cause changes in committed files and anti-tamper checks will fail.

Projen upgrades are covered through the ProjenUpgrade class.


labelsOptional ​
public readonly labels: string[];
  • Type: string[]

List of labels to apply to the created PR's.


openPullRequestsLimitOptional ​
public readonly openPullRequestsLimit: number;
  • Type: number
  • Default: 5

Sets the maximum of pull requests Dependabot opens for version updates.

Dependabot will not open any new requests until some of those open requests are merged or closed.


registriesOptional ​
public readonly registries: {[ key: string ]: DependabotRegistry};

Map of package registries to use.


reviewersOptional ​
public readonly reviewers: string[];
  • Type: string[]
  • Default: []

Specify individual reviewers or teams of reviewers for all pull requests raised for a package manager.


scheduleIntervalOptional ​
public readonly scheduleInterval: DependabotScheduleInterval;

How often to check for new versions and raise pull requests.


targetBranchOptional ​
public readonly targetBranch: string;
  • Type: string

https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#target-branch You can configure the target branch for raising pull requests for version updates against.


versioningStrategyOptional ​
public readonly versioningStrategy: VersioningStrategy;
  • Type: VersioningStrategy
  • Default: VersioningStrategy.LOCKFILE_ONLY The default is to only update the lock file because package.json is controlled by projen and any outside updates will fail the build.

The strategy to use when edits manifest and lock files.


DependabotRegistry ​

Use to add private registry support for dependabot.

https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#configuration-options-for-private-registries

Initializer ​

import { github } from 'projen'

const dependabotRegistry: github.DependabotRegistry = { ... }

Properties ​

NameTypeDescription
type
DependabotRegistryType
Registry type e.g. 'npm-registry' or 'docker-registry'.
url
stringUrl for the registry e.g. 'https://npm.pkg.github.com' or 'registry.hub.docker.com'.
key
stringA reference to a Dependabot secret containing an access key for this registry.
organization
stringUsed with the hex-organization registry type.
password
stringA reference to a Dependabot secret containing the password for the specified user.
replacesBase
booleanFor registries with type: python-index, if the boolean value is true, pip esolves dependencies by using the specified URL rather than the base URL of the Python Package Index (by default https://pypi.org/simple).
token
stringSecret token for dependabot access e.g. '${{ secrets.DEPENDABOT_PACKAGE_TOKEN }}'.
username
stringThe username that Dependabot uses to access the registry.

typeRequired ​
public readonly type: DependabotRegistryType;

Registry type e.g. 'npm-registry' or 'docker-registry'.


urlRequired ​
public readonly url: string;
  • Type: string

Url for the registry e.g. 'https://npm.pkg.github.com' or 'registry.hub.docker.com'.


keyOptional ​
public readonly key: string;
  • Type: string
  • Default: undefined

A reference to a Dependabot secret containing an access key for this registry.


organizationOptional ​
public readonly organization: string;
  • Type: string
  • Default: undefined

Used with the hex-organization registry type.

https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#hex-organization


passwordOptional ​
public readonly password: string;
  • Type: string
  • Default: undefined

A reference to a Dependabot secret containing the password for the specified user.


replacesBaseOptional ​
public readonly replacesBase: boolean;
  • Type: boolean
  • Default: undefined

For registries with type: python-index, if the boolean value is true, pip esolves dependencies by using the specified URL rather than the base URL of the Python Package Index (by default https://pypi.org/simple).


tokenOptional ​
public readonly token: string;
  • Type: string
  • Default: undefined

Secret token for dependabot access e.g. '${{ secrets.DEPENDABOT_PACKAGE_TOKEN }}'.


usernameOptional ​
public readonly username: string;
  • Type: string
  • Default: do not authenticate

The username that Dependabot uses to access the registry.


DependencyReviewOptions ​

Options for the DependencyReview component.

Initializer ​

import { github } from 'projen'

const dependencyReviewOptions: github.DependencyReviewOptions = { ... }

Properties ​

NameTypeDescription
runsOn
string[]Github Runner selection labels.
runsOnGroup
projen.GroupRunnerOptionsGithub Runner Group selection options.
allowGhsas
string[]GitHub Advisory Database IDs that can be skipped during detection.
allowLicenses
string[]List of allowed SPDX license identifiers.
commentSummaryInPr
stringWhether to post a comment summary on the PR.
configFile
stringPath to an external configuration file.
denyPackages
string[]Packages to block in a PR (in purl format).
failOnScopes
string[]Scopes of dependencies to fail on.
failOnSeverity
stringThe severity level at which the action will fail.
licenseCheck
booleanEnable or disable the license check.
showOpenSSFScorecard
booleanShow OpenSSF Scorecard scores for dependencies.
vulnerabilityCheck
booleanEnable or disable the vulnerability check.
warnOnly
booleanWhen true, the action will only warn and not fail.
warnOnOpenSSFScorecardLevel
numberScore threshold for OpenSSF Scorecard warnings.

runsOnOptional ​
public readonly runsOn: string[];
  • Type: string[]
  • Default: ["ubuntu-latest"]

Github Runner selection labels.


runsOnGroupOptional ​
public readonly runsOnGroup: GroupRunnerOptions;
  • Type: projen.GroupRunnerOptions

Github Runner Group selection options.


allowGhsasOptional ​
public readonly allowGhsas: string[];
  • Type: string[]
  • Default: no advisories are skipped

GitHub Advisory Database IDs that can be skipped during detection.


allowLicensesOptional ​
public readonly allowLicenses: string[];
  • Type: string[]
  • Default: no license allow-list

List of allowed SPDX license identifiers.


commentSummaryInPrOptional ​
public readonly commentSummaryInPr: string;
  • Type: string
  • Default: "always"

Whether to post a comment summary on the PR.


configFileOptional ​
public readonly configFile: string;
  • Type: string
  • Default: no external config

Path to an external configuration file.


denyPackagesOptional ​
public readonly denyPackages: string[];
  • Type: string[]
  • Default: no packages are denied

Packages to block in a PR (in purl format).


failOnScopesOptional ​
public readonly failOnScopes: string[];
  • Type: string[]
  • Default: no scopes filter (action default is "runtime")

Scopes of dependencies to fail on.


failOnSeverityOptional ​
public readonly failOnSeverity: string;
  • Type: string
  • Default: no minimum severity (action default is "low")

The severity level at which the action will fail.


licenseCheckOptional ​
public readonly licenseCheck: boolean;
  • Type: boolean
  • Default: true

Enable or disable the license check.


showOpenSSFScorecardOptional ​
public readonly showOpenSSFScorecard: boolean;
  • Type: boolean
  • Default: true

Show OpenSSF Scorecard scores for dependencies.


vulnerabilityCheckOptional ​
public readonly vulnerabilityCheck: boolean;
  • Type: boolean
  • Default: true

Enable or disable the vulnerability check.


warnOnlyOptional ​
public readonly warnOnly: boolean;
  • Type: boolean
  • Default: false

When true, the action will only warn and not fail.


warnOnOpenSSFScorecardLevelOptional ​
public readonly warnOnOpenSSFScorecardLevel: number;
  • Type: number
  • Default: 3

Score threshold for OpenSSF Scorecard warnings.


DownloadArtifactOptions ​

Initializer ​

import { github } from 'projen'

const downloadArtifactOptions: github.DownloadArtifactOptions = { ... }

Properties ​

NameTypeDescription
env
{[ key: string ]: string}Sets environment variables for steps to use in the runner environment.
id
stringA unique identifier for the step.
if
stringYou can use the if conditional to prevent a job from running unless a condition is met.
name
stringA name for your step to display on GitHub.
shell
stringOverrides the default shell settings in the runner's operating system and the job's default.
workingDirectory
stringSpecifies a working directory for a step.
background
booleanRuns a step asynchronously so the job continues to the next step without waiting for it to finish.
cancel
stringGracefully terminates a running background step, referenced by its id.
continueOnError
booleanPrevents a job from failing when a step fails.
parallel
JobStep[]
Runs a group of steps concurrently, then waits for all of them to finish before continuing.
timeoutMinutes
numberThe maximum number of minutes to run the step before killing the process.
wait
string[]Pauses the job until one or more background steps complete. Provide the ids of the background steps to wait for.
waitAll
booleanPauses the job until all active background steps complete.
with
DownloadArtifactWith
Options for download-artifact.

envOptional ​
public readonly env: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

Sets environment variables for steps to use in the runner environment.

You can also set environment variables for the entire workflow or a job.


idOptional ​
public readonly id: string;
  • Type: string

A unique identifier for the step.

You can use the id to reference the step in contexts.


ifOptional ​
public readonly if: string;
  • Type: string

You can use the 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.


nameOptional ​
public readonly name: string;
  • Type: string

A name for your step to display on GitHub.


shellOptional ​
public readonly shell: string;
  • Type: string

Overrides the default shell settings in the runner's operating system and the job's default.

Refer to GitHub documentation for allowed values.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell


workingDirectoryOptional ​
public readonly workingDirectory: string;
  • Type: string

Specifies a working directory for a step.

Overrides a job's working directory.


backgroundOptional ​
public readonly background: boolean;
  • Type: boolean

Runs a step asynchronously so the job continues to the next step without waiting for it to finish.

Use for long-running processes, such as databases, servers, or monitoring tasks, that need to run alongside other steps.

Synchronize with background steps later using wait or waitAll, or stop them with cancel. Give the step an id so it can be referenced.

A maximum of 10 background steps can run concurrently in a single job; additional background steps are queued until a slot is free.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsbackground


cancelOptional ​
public readonly cancel: string;
  • Type: string

Gracefully terminates a running background step, referenced by its id.

The runner sends the step's process a termination signal (SIGTERM) so it can clean up, and forcibly stops it (SIGKILL) if it does not exit within a short grace period.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepscancel


continueOnErrorOptional ​
public readonly continueOnError: boolean;
  • Type: boolean

Prevents a job from failing when a step fails.

Set to true to allow a job to pass when this step fails.


parallelOptional ​
public readonly parallel: JobStep[];

Runs a group of steps concurrently, then waits for all of them to finish before continuing.

This is shorthand for declaring each step with background: true followed by a wait step.

Use this when you have a self-contained group of independent steps that can all run at the same time and don't need to be referenced individually. Use background instead when you need finer control, such as starting a long-running process that stays up while later steps run.

Each step in the group is subject to the same 10-step concurrency limit as other background steps. Cannot be used inside a composite action.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsparallel


timeoutMinutesOptional ​
public readonly timeoutMinutes: number;
  • Type: number

The maximum number of minutes to run the step before killing the process.


waitOptional ​
public readonly wait: string[];
  • Type: string[]

Pauses the job until one or more background steps complete. Provide the ids of the background steps to wait for.

This step performs no work itself; it only blocks until the referenced background steps finish. If a referenced background step failed, the wait step fails too.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswait


waitAllOptional ​
public readonly waitAll: boolean;
  • Type: boolean

Pauses the job until all active background steps complete.

Fails if any of the background steps it waits on failed, unless continueOnError is set on this step.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswait-all


withRequired ​
public readonly with: DownloadArtifactWith;

Options for download-artifact.


DownloadArtifactWith ​

Initializer ​

import { github } from 'projen'

const downloadArtifactWith: github.DownloadArtifactWith = { ... }

Properties ​

NameTypeDescription
artifactIds
string[]IDs of the artifacts to download.
mergeMultiple
booleanWhen multiple artifacts are matched, this changes the behavior of the destination directories If true, the downloaded artifacts will be in the same directory specified by path If false, the downloaded artifacts will be extracted into individual named directories within the specified path.
name
stringName of the artifact to download.
path
stringA file, directory or wildcard pattern that describes what to download.
pattern
stringA glob pattern to the artifacts that should be downloaded This is ignored if name is specified.
repository
stringThe repository owner and the repository name joined together by "/" If github-token is specified, this is the repository that artifacts will be downloaded from.
runId
stringThe id of the workflow run where the desired download artifact was uploaded from If github-token is specified, this is the run that artifacts will be downloaded from.
token
stringThe GitHub token used to authenticate with the GitHub API to download artifacts from a different repository or from a different workflow run.

artifactIdsOptional ​
public readonly artifactIds: string[];
  • Type: string[]

IDs of the artifacts to download.

Either inputs artifact-ids or name can be used, but not both.


mergeMultipleOptional ​
public readonly mergeMultiple: boolean;
  • Type: boolean
  • Default: false

When multiple artifacts are matched, this changes the behavior of the destination directories If true, the downloaded artifacts will be in the same directory specified by path If false, the downloaded artifacts will be extracted into individual named directories within the specified path.


nameOptional ​
public readonly name: string;
  • Type: string
  • Default: If unspecified, all artifacts for the run are downloaded

Name of the artifact to download.


pathOptional ​
public readonly path: string;
  • Type: string
  • Default: $GITHUB_WORKSPACE

A file, directory or wildcard pattern that describes what to download.

Supports basic tilde expansion.


patternOptional ​
public readonly pattern: string;
  • Type: string

A glob pattern to the artifacts that should be downloaded This is ignored if name is specified.


repositoryOptional ​
public readonly repository: string;
  • Type: string
  • Default: ${{ github.repository }}

The repository owner and the repository name joined together by "/" If github-token is specified, this is the repository that artifacts will be downloaded from.


runIdOptional ​
public readonly runId: string;
  • Type: string
  • Default: ${{ github.run_id }}

The id of the workflow run where the desired download artifact was uploaded from If github-token is specified, this is the run that artifacts will be downloaded from.


tokenOptional ​
public readonly token: string;
  • Type: string
  • Default: If unspecified, the action will download artifacts from the current repo and the current workflow run

The GitHub token used to authenticate with the GitHub API to download artifacts from a different repository or from a different workflow run.


GithubCredentialsAppOptions ​

Options for GithubCredentials.fromApp.

Initializer ​

import { github } from 'projen'

const githubCredentialsAppOptions: github.GithubCredentialsAppOptions = { ... }

Properties ​

NameTypeDescription
appIdSecret
stringThe secret containing the GitHub App ID.
environment
stringThe GitHub Actions environment the secrets are added to.
owner
stringThe owner of the GitHub App installation.
permissions
AppPermissions
The permissions granted to the token.
privateKeySecret
stringThe secret containing the GitHub App private key.
repositories
string[]List of repositories to grant access to.

appIdSecretOptional ​
public readonly appIdSecret: string;
  • Type: string
  • Default: "PROJEN_APP_ID"

The secret containing the GitHub App ID.


environmentOptional ​
public readonly environment: string;
  • Type: string
  • Default: no environment used

The GitHub Actions environment the secrets are added to.

This can be used to add explicit approval steps to access the secrets.


ownerOptional ​
public readonly owner: string;
  • Type: string
  • Default: if empty, defaults to the current repository owner

The owner of the GitHub App installation.


permissionsOptional ​
public readonly permissions: AppPermissions;

The permissions granted to the token.


privateKeySecretOptional ​
public readonly privateKeySecret: string;
  • Type: string
  • Default: "PROJEN_APP_PRIVATE_KEY"

The secret containing the GitHub App private key.

Escaped newlines (\n) will be automatically replaced with actual newlines.


repositoriesOptional ​
public readonly repositories: string[];
  • Type: string[]
  • Default: if owner is set and repositories is empty, access will be scoped to all repositories in the provided repository owner's installation. If owner and repositories are empty, access will be scoped to only the current repository.

List of repositories to grant access to.


GithubCredentialsPersonalAccessTokenOptions ​

Options for GithubCredentials.fromPersonalAccessToken.

Initializer ​

import { github } from 'projen'

const githubCredentialsPersonalAccessTokenOptions: github.GithubCredentialsPersonalAccessTokenOptions = { ... }

Properties ​

NameTypeDescription
environment
stringThe GitHub Actions environment the secrets is added to.
secret
stringThe name of the secret that holds the GitHub personal access token.

environmentOptional ​
public readonly environment: string;
  • Type: string
  • Default: no environment used

The GitHub Actions environment the secrets is added to.

This can be used to add explicit approval steps to access the secret.


secretOptional ​
public readonly secret: string;
  • Type: string
  • Default: "PROJEN_GITHUB_TOKEN"

The name of the secret that holds the GitHub personal access token.


GitHubOptions ​

Initializer ​

import { github } from 'projen'

const gitHubOptions: github.GitHubOptions = { ... }

Properties ​

NameTypeDescription
checkoutSubmodules
CheckoutSubmodules
Whether to checkout Git submodules.
dependencyReview
booleanEnable the dependency-review-action workflow on pull requests.
dependencyReviewOptions
DependencyReviewOptions
Options for the dependency review workflow.
downloadLfs
booleanDownload files in LFS in workflows.
mergeQueue
booleanWhether a merge queue should be used on this repository to merge pull requests.
mergeQueueOptions
MergeQueueOptions
Options for MergeQueue.
mergify
booleanWhether mergify should be enabled on this repository or not.
mergifyOptions
MergifyOptions
Options for Mergify.
projenCredentials
GithubCredentials
Choose a method of providing GitHub API access for projen workflows.
pullRequestBackport
booleanAdd a workflow that allows backport of PRs to other branches using labels.
pullRequestBackportOptions
PullRequestBackportOptions
Options for configuring pull request backport.
pullRequestLint
booleanAdd a workflow that performs basic checks for pull requests, like validating that PRs follow Conventional Commits.
pullRequestLintOptions
PullRequestLintOptions
Options for configuring a pull request linter.
workflowRunsOn
string[]Github Runner selection labels.
workflowRunsOnGroup
projen.GroupRunnerOptionsGithub Runner Group selection options.
workflows
booleanEnables GitHub workflows.

checkoutSubmodulesOptional ​
public readonly checkoutSubmodules: CheckoutSubmodules;

Whether to checkout Git submodules.


dependencyReviewOptional ​
public readonly dependencyReview: boolean;
  • Type: boolean
  • Default: false

Enable the dependency-review-action workflow on pull requests.

Adds a separate workflow that runs actions/dependency-review-action to scan pull requests for newly introduced vulnerable or non-compliant dependencies.


dependencyReviewOptionsOptional ​
public readonly dependencyReviewOptions: DependencyReviewOptions;

Options for the dependency review workflow.

Only used when dependencyReview is true.


downloadLfsOptional ​
public readonly downloadLfs: boolean;
  • Type: boolean
  • Default: true if the associated project has lfsPatterns, false otherwise

Download files in LFS in workflows.


mergeQueueOptional ​
public readonly mergeQueue: boolean;
  • Type: boolean
  • Default: false

Whether a merge queue should be used on this repository to merge pull requests.

Requires additional configuration of the repositories branch protection rules.


mergeQueueOptionsOptional ​
public readonly mergeQueueOptions: MergeQueueOptions;

Options for MergeQueue.


mergifyOptional ​
public readonly mergify: boolean;
  • Type: boolean
  • Default: true

Whether mergify should be enabled on this repository or not.


mergifyOptionsOptional ​
public readonly mergifyOptions: MergifyOptions;

Options for Mergify.


projenCredentialsOptional ​
public readonly projenCredentials: GithubCredentials;
  • Type: GithubCredentials
  • Default: use a personal access token named PROJEN_GITHUB_TOKEN

Choose a method of providing GitHub API access for projen workflows.


pullRequestBackportOptional ​
public readonly pullRequestBackport: boolean;
  • Type: boolean
  • Default: false

Add a workflow that allows backport of PRs to other branches using labels.

When opening a new PR add a backport label to it, and the PR will be backported to the target branches once the PR is merged.

Should not be used together with mergify.


pullRequestBackportOptionsOptional ​
public readonly pullRequestBackportOptions: PullRequestBackportOptions;

Options for configuring pull request backport.


pullRequestLintOptional ​
public readonly pullRequestLint: boolean;
  • Type: boolean
  • Default: true

Add a workflow that performs basic checks for pull requests, like validating that PRs follow Conventional Commits.


pullRequestLintOptionsOptional ​
public readonly pullRequestLintOptions: PullRequestLintOptions;

Options for configuring a pull request linter.


workflowRunsOnOptional ​
public readonly workflowRunsOn: string[];
  • Type: string[]
  • Default: ["ubuntu-latest"]

Github Runner selection labels.


workflowRunsOnGroupOptional ​
public readonly workflowRunsOnGroup: GroupRunnerOptions;
  • Type: projen.GroupRunnerOptions

Github Runner Group selection options.


workflowsOptional ​
public readonly workflows: boolean;
  • Type: boolean
  • Default: true

Enables GitHub workflows.

If this is set to false, workflows will not be created.


GitHubProjectOptions ​

Options for GitHubProject.

Initializer ​

import { github } from 'projen'

const gitHubProjectOptions: github.GitHubProjectOptions = { ... }

Properties ​

NameTypeDescription
name
stringThis is the name of your project.
commitGenerated
booleanWhether to commit the managed files by default.
gitIgnoreOptions
projen.IgnoreFileOptionsConfiguration options for .gitignore file.
gitOptions
projen.GitOptionsConfiguration options for git.
logging
projen.LoggerOptionsConfigure logging options such as verbosity.
outdir
stringThe root directory of the project.
parent
projen.ProjectThe parent project, if this project is part of a bigger project.
projectTree
booleanGenerate a project tree file (.projen/tree.json) that shows all components and their relationships. Useful for understanding your project structure and debugging.
projenCommand
stringThe shell command to use in order to run the projen CLI.
projenrcJson
booleanGenerate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation.
projenrcJsonOptions
projen.ProjenrcJsonOptionsOptions for .projenrc.json.
renovatebot
booleanUse renovatebot to handle dependency upgrades.
renovatebotOptions
projen.RenovatebotOptionsOptions for renovatebot.
autoApproveOptions
AutoApproveOptions
Enable and configure the 'auto approve' workflow.
autoMerge
booleanEnable automatic merging on GitHub.
autoMergeOptions
AutoMergeOptions
Configure options for automatic merging on GitHub.
clobber
booleanAdd a clobber task which resets the repo to origin.
devContainer
booleanAdd a VSCode development environment (used for GitHub Codespaces).
github
booleanEnable GitHub integration.
githubOptions
GitHubOptions
Options for GitHub integration.
gitpod
booleanAdd a Gitpod development environment.
projenCredentials
GithubCredentials
Choose a method of providing GitHub API access for projen workflows.
readme
projen.SampleReadmePropsThe README setup.
stale
booleanAuto-close of stale issues and pull request.
staleOptions
StaleOptions
Auto-close stale issues and pull requests.
vscode
booleanEnable VSCode integration.

nameRequired ​
public readonly name: string;
  • Type: string
  • Default: $BASEDIR

This is the name of your project.


commitGeneratedOptional ​
public readonly commitGenerated: boolean;
  • Type: boolean
  • Default: true

Whether to commit the managed files by default.


gitIgnoreOptionsOptional ​
public readonly gitIgnoreOptions: IgnoreFileOptions;
  • Type: projen.IgnoreFileOptions

Configuration options for .gitignore file.


gitOptionsOptional ​
public readonly gitOptions: GitOptions;
  • Type: projen.GitOptions

Configuration options for git.


loggingOptional ​
public readonly logging: LoggerOptions;
  • Type: projen.LoggerOptions
  • Default: {}

Configure logging options such as verbosity.


outdirOptional ​
public readonly outdir: string;
  • Type: string
  • Default: "."

The root directory of the project.

Relative to this directory, all files are synthesized.

If this project has a parent, this directory is relative to the parent directory and it cannot be the same as the parent or any of it's other subprojects.


parentOptional ​
public readonly parent: Project;
  • Type: projen.Project

The parent project, if this project is part of a bigger project.


projectTreeOptional ​
public readonly projectTree: boolean;
  • Type: boolean
  • Default: false

Generate a project tree file (.projen/tree.json) that shows all components and their relationships. Useful for understanding your project structure and debugging.


projenCommandOptional ​
public readonly projenCommand: string;
  • Type: string
  • Default: "npx projen"

The shell command to use in order to run the projen CLI.

Inserted verbatim into task steps, workflows and IDE configuration, and run by each of their shells - locally, in CI and in dev containers. Keep it a plain unquoted command, since shell syntax in it executes in all of them.

Can be used to customize in special environments.


projenrcJsonOptional ​
public readonly projenrcJson: boolean;
  • Type: boolean
  • Default: false

Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation.


projenrcJsonOptionsOptional ​
public readonly projenrcJsonOptions: ProjenrcJsonOptions;
  • Type: projen.ProjenrcJsonOptions
  • Default: default options

Options for .projenrc.json.


renovatebotOptional ​
public readonly renovatebot: boolean;
  • Type: boolean
  • Default: false

Use renovatebot to handle dependency upgrades.


renovatebotOptionsOptional ​
public readonly renovatebotOptions: RenovatebotOptions;
  • Type: projen.RenovatebotOptions
  • Default: default options

Options for renovatebot.


autoApproveOptionsOptional ​
public readonly autoApproveOptions: AutoApproveOptions;

Enable and configure the 'auto approve' workflow.


autoMergeOptional ​
public readonly autoMerge: boolean;
  • Type: boolean
  • Default: true

Enable automatic merging on GitHub.

Has no effect if github.mergify is set to false.


autoMergeOptionsOptional ​
public readonly autoMergeOptions: AutoMergeOptions;

Configure options for automatic merging on GitHub.

Has no effect if github.mergify or autoMerge is set to false.


clobberOptional ​
public readonly clobber: boolean;
  • Type: boolean
  • Default: true, but false for subprojects

Add a clobber task which resets the repo to origin.


devContainerOptional ​
public readonly devContainer: boolean;
  • Type: boolean
  • Default: false

Add a VSCode development environment (used for GitHub Codespaces).


githubOptional ​
public readonly github: boolean;
  • Type: boolean
  • Default: true

Enable GitHub integration.

Enabled by default for root projects. Disabled for non-root projects.


githubOptionsOptional ​
public readonly githubOptions: GitHubOptions;

Options for GitHub integration.


gitpodOptional ​
public readonly gitpod: boolean;
  • Type: boolean
  • Default: false

Add a Gitpod development environment.


projenCredentialsOptional ​
public readonly projenCredentials: GithubCredentials;
  • Type: GithubCredentials
  • Default: use a personal access token named PROJEN_GITHUB_TOKEN

Choose a method of providing GitHub API access for projen workflows.


readmeOptional ​
public readonly readme: SampleReadmeProps;
  • Type: projen.SampleReadmeProps
  • Default: { filename: 'README.md', contents: '# replace this' }

The README setup.


Example

"{ filename: 'readme.md', contents: '# title' }"
staleOptional ​
public readonly stale: boolean;
  • Type: boolean
  • Default: false

Auto-close of stale issues and pull request.

See staleOptions for options.


staleOptionsOptional ​
public readonly staleOptions: StaleOptions;

Auto-close stale issues and pull requests.

To disable set stale to false.


vscodeOptional ​
public readonly vscode: boolean;
  • Type: boolean
  • Default: true

Enable VSCode integration.

Enabled by default for root projects. Disabled for non-root projects.


GithubWorkflowOptions ​

Options for GithubWorkflow.

Initializer ​

import { github } from 'projen'

const githubWorkflowOptions: github.GithubWorkflowOptions = { ... }

Properties ​

NameTypeDescription
concurrencyOptions
ConcurrencyOptions
Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time.
env
{[ key: string ]: string}Additional environment variables to set for the workflow.
fileName
stringSet a custom file name for the workflow definition file. Must include either a .yml or .yaml file extension.
force
booleanForce the creation of the workflow even if workflows is disabled in GitHub.
limitConcurrency
booleanEnable concurrency limitations.

concurrencyOptionsOptional ​
public readonly concurrencyOptions: ConcurrencyOptions;
  • Type: ConcurrencyOptions
  • Default: { group: ${{ github.workflow }}, cancelInProgress: false }

Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time.

Currently in beta.

https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#concurrency


envOptional ​
public readonly env: {[ key: string ]: string};
  • Type: {[ key: string ]: string}
  • Default: no additional environment variables

Additional environment variables to set for the workflow.


fileNameOptional ​
public readonly fileName: string;
  • Type: string
  • Default: a path-safe version of the workflow name plus the .yml file ending, e.g. build.yml

Set a custom file name for the workflow definition file. Must include either a .yml or .yaml file extension.

Use this option to set a file name for the workflow file, that is different than the display name.


Example

"my-workflow.yaml"
forceOptional ​
public readonly force: boolean;
  • Type: boolean
  • Default: false

Force the creation of the workflow even if workflows is disabled in GitHub.


limitConcurrencyOptional ​
public readonly limitConcurrency: boolean;
  • Type: boolean
  • Default: false

Enable concurrency limitations.

Use concurrencyOptions to configure specific non default values.


GitIdentity ​

Represents the git identity.

Initializer ​

import { github } from 'projen'

const gitIdentity: github.GitIdentity = { ... }

Properties ​

NameTypeDescription
email
stringThe email address of the git user.
name
stringThe name of the user.

emailRequired ​
public readonly email: string;
  • Type: string

The email address of the git user.


nameRequired ​
public readonly name: string;
  • Type: string

The name of the user.


MergeQueueOptions ​

Options for 'MergeQueue'.

Initializer ​

import { github } from 'projen'

const mergeQueueOptions: github.MergeQueueOptions = { ... }

Properties ​

NameTypeDescription
autoQueue
booleanShould pull requests be queued automatically to be merged once they pass required checks.
autoQueueOptions
AutoQueueOptions
Configure auto-queue pull requests.
targetBranches
string[]The branches that can be merged into using MergeQueue.

autoQueueOptional ​
public readonly autoQueue: boolean;
  • Type: boolean
  • Default: true

Should pull requests be queued automatically to be merged once they pass required checks.


autoQueueOptionsOptional ​
public readonly autoQueueOptions: AutoQueueOptions;

Configure auto-queue pull requests.


targetBranchesOptional ​
public readonly targetBranches: string[];
  • Type: string[]
  • Default: all branches

The branches that can be merged into using MergeQueue.


MergifyCommitMessageFormat ​

Declarative configuration for Mergify commit_message_format.

https://docs.mergify.com/workflow/actions/merge/#customizing-the-commit-message

Initializer ​

import { github } from 'projen'

const mergifyCommitMessageFormat: github.MergifyCommitMessageFormat = { ... }

Properties ​

NameTypeDescription
body
stringCommit body format.
title
stringCommit title format.
trailers
string[]Optional list of trailers to append to the commit message.

bodyOptional ​
public readonly body: string;
  • Type: string

Commit body format.

inherit: use the GitHub repository default merge commit body format

  • pr-body: use the pull request body
  • empty: set the commit body to be empty

titleOptional ​
public readonly title: string;
  • Type: string

Commit title format.

inherit: use the GitHub repository default merge commit title format

  • pr-title: use the pull request title (with the PR number appended)

trailersOptional ​
public readonly trailers: string[];
  • Type: string[]

Optional list of trailers to append to the commit message.


MergifyConditionalOperator ​

The Mergify conditional operators that can be used are: or and and.

Note: The number of nested conditions is limited to 3.

https://docs.mergify.io/conditions/#combining-conditions-with-operators

Initializer ​

import { github } from 'projen'

const mergifyConditionalOperator: github.MergifyConditionalOperator = { ... }

Properties ​

NameTypeDescription
and
string | MergifyConditionalOperator[]
No description.
or
string | MergifyConditionalOperator[]
No description.

andOptional ​
public readonly and: (string | MergifyConditionalOperator)[];

orOptional ​
public readonly or: (string | MergifyConditionalOperator)[];

MergifyOptions ​

Configure Mergify.

This currently only offers a subset of options available.

https://docs.mergify.com/configuration/file-format/

Initializer ​

import { github } from 'projen'

const mergifyOptions: github.MergifyOptions = { ... }

Properties ​

NameTypeDescription
queues
MergifyQueue[]
The available merge queues.
rules
MergifyRule[]
Pull request automation rules.

queuesOptional ​
public readonly queues: MergifyQueue[];

The available merge queues.


rulesOptional ​
public readonly rules: MergifyRule[];

Pull request automation rules.


MergifyQueue ​

Initializer ​

import { github } from 'projen'

const mergifyQueue: github.MergifyQueue = { ... }

Properties ​

NameTypeDescription
name
stringThe name of the queue.
commitMessageFormat
MergifyCommitMessageFormat
When merging with the merge or squash method, configure the title, body, and trailers of the resulting commit.
commitMessageTemplate
stringTemplate to use as the commit message when using the merge or squash merge method.
mergeConditions
string | MergifyConditionalOperator[]
The list of conditions to match to get the queued pull request merged.
mergeMethod
stringMerge method to use.
queueConditions
string | MergifyConditionalOperator[]
The list of conditions that needs to match to queue the pull request.
updateMethod
stringMethod to use to update the pull request with its base branch when the speculative check is done in-place.

nameRequired ​
public readonly name: string;
  • Type: string

The name of the queue.


commitMessageFormatOptional ​
public readonly commitMessageFormat: MergifyCommitMessageFormat;

When merging with the merge or squash method, configure the title, body, and trailers of the resulting commit.

https://docs.mergify.com/workflow/actions/merge/#customizing-the-commit-message


commitMessageTemplateOptional ​
  • Deprecated: Use commitMessageFormat instead.
public readonly commitMessageTemplate: string;
  • Type: string

Template to use as the commit message when using the merge or squash merge method.


mergeConditionsOptional ​
public readonly mergeConditions: (string | MergifyConditionalOperator)[];

The list of conditions to match to get the queued pull request merged.

This automatically includes the queueConditions. In case of speculative merge pull request, the merge conditions are evaluated against the temporary pull request instead of the original one.

https://docs.mergify.com/conditions/#conditions


mergeMethodOptional ​
public readonly mergeMethod: string;
  • Type: string
  • Default: "merge"

Merge method to use.

Possible values are merge, squash, rebase or fast-forward. fast-forward is not supported on queues with speculative_checks > 1, batch_size > 1, or with allow_inplace_checks set to false.


queueConditionsOptional ​
public readonly queueConditions: (string | MergifyConditionalOperator)[];

The list of conditions that needs to match to queue the pull request.

https://docs.mergify.com/conditions/#conditions


updateMethodOptional ​
public readonly updateMethod: string;
  • Type: string
  • Default: merge for all merge methods except fast-forward where rebase is used

Method to use to update the pull request with its base branch when the speculative check is done in-place.

Possible values:

  • merge to merge the base branch into the pull request.
  • rebase to rebase the pull request against its base branch.

Note that the rebase method has some drawbacks, see Mergify docs for details.

https://docs.mergify.com/actions/queue/#queue-rules


MergifyRule ​

Initializer ​

import { github } from 'projen'

const mergifyRule: github.MergifyRule = { ... }

Properties ​

NameTypeDescription
actions
{[ key: string ]: any}A dictionary made of Actions that will be executed on the matching pull requests.
conditions
string | MergifyConditionalOperator[]
A list of Conditions string that must match against the pull request for the rule to be applied.
name
stringThe name of the rule.

actionsRequired ​
public readonly actions: {[ key: string ]: any};
  • Type: {[ key: string ]: any}

A dictionary made of Actions that will be executed on the matching pull requests.

https://docs.mergify.io/actions/#actions


conditionsRequired ​
public readonly conditions: (string | MergifyConditionalOperator)[];

A list of Conditions string that must match against the pull request for the rule to be applied.

https://docs.mergify.io/conditions/#conditions


nameRequired ​
public readonly name: string;
  • Type: string

The name of the rule.

This is not used by the engine directly, but is used when reporting information about a rule.


PullRequestBackportOptions ​

Initializer ​

import { github } from 'projen'

const pullRequestBackportOptions: github.PullRequestBackportOptions = { ... }

Properties ​

NameTypeDescription
runsOn
string[]Github Runner selection labels.
runsOnGroup
projen.GroupRunnerOptionsGithub Runner Group selection options.
autoApproveBackport
booleanAutomatically approve backport PRs if the 'auto approve' workflow is available.
backportBranchNamePrefix
stringThe prefix used to name backport branches.
backportPRLabels
string[]The labels added to the created backport PR.
branches
string[]List of branches that can be a target for backports.
createWithConflicts
booleanShould this created Backport PRs with conflicts.
labelPrefix
stringThe prefix used to detect PRs that should be backported.
workflowName
stringThe name of the workflow.

runsOnOptional ​
public readonly runsOn: string[];
  • Type: string[]
  • Default: ["ubuntu-latest"]

Github Runner selection labels.


runsOnGroupOptional ​
public readonly runsOnGroup: GroupRunnerOptions;
  • Type: projen.GroupRunnerOptions

Github Runner Group selection options.


autoApproveBackportOptional ​
public readonly autoApproveBackport: boolean;
  • Type: boolean
  • Default: true

Automatically approve backport PRs if the 'auto approve' workflow is available.


backportBranchNamePrefixOptional ​
public readonly backportBranchNamePrefix: string;
  • Type: string
  • Default: "backport/"

The prefix used to name backport branches.

Make sure to include a separator at the end like / or _.


backportPRLabelsOptional ​
public readonly backportPRLabels: string[];
  • Type: string[]
  • Default: ["backport"]

The labels added to the created backport PR.


branchesOptional ​
public readonly branches: string[];
  • Type: string[]
  • Default: allow backports to all release branches

List of branches that can be a target for backports.


createWithConflictsOptional ​
public readonly createWithConflicts: boolean;
  • Type: boolean
  • Default: true

Should this created Backport PRs with conflicts.

Conflicts will have to be resolved manually, but a PR is always created. Set to false to prevent the backport PR from being created if there are conflicts.


labelPrefixOptional ​
public readonly labelPrefix: string;
  • Type: string
  • Default: "backport-to-"

The prefix used to detect PRs that should be backported.


workflowNameOptional ​
public readonly workflowName: string;
  • Type: string
  • Default: "backport"

The name of the workflow.


PullRequestFromPatchOptions ​

Initializer ​

import { github } from 'projen'

const pullRequestFromPatchOptions: github.PullRequestFromPatchOptions = { ... }

Properties ​

NameTypeDescription
pullRequestDescription
stringDescription added to the pull request.
pullRequestTitle
stringThe full title used to create the pull request.
workflowName
stringThe name of the workflow that will create the PR.
addPaths
string[]Paths to add to the commit, mapping to the action's add-paths input.
assignees
string[]Assignees to add on the PR.
baseBranch
stringSets the pull request base branch.
branchName
stringThe pull request branch name.
credentials
GithubCredentials
The job credentials used to create the pull request.
deleteBranch
booleanWhether to delete the pull request branch when the pull request is closed, mapping to the action's delete-branch input.
gitIdentity
GitIdentity
The git identity used to create the commit.
labels
string[]Labels to apply on the PR.
signoff
booleanAdd Signed-off-by line by the committer at the end of the commit log message.
stepId
stringThe step ID which produces the output which indicates if a patch was created.
stepName
stringThe name of the step displayed on GitHub.
patch
PullRequestPatchSource
Information about the patch that is used to create the pull request.
jobName
stringThe name of the job displayed on GitHub.
runsOn
string[]Github Runner selection labels.
runsOnGroup
projen.GroupRunnerOptionsGithub Runner Group selection options.

pullRequestDescriptionRequired ​
public readonly pullRequestDescription: string;
  • Type: string

Description added to the pull request.

Providence information are automatically added.


pullRequestTitleRequired ​
public readonly pullRequestTitle: string;
  • Type: string

The full title used to create the pull request.

If PR titles are validated in this repo, the title should comply with the respective rules.


workflowNameRequired ​
public readonly workflowName: string;
  • Type: string

The name of the workflow that will create the PR.


addPathsOptional ​
public readonly addPaths: string[];
  • Type: string[]
  • Default: all paths

Paths to add to the commit, mapping to the action's add-paths input.


assigneesOptional ​
public readonly assignees: string[];
  • Type: string[]
  • Default: no assignees

Assignees to add on the PR.


baseBranchOptional ​
public readonly baseBranch: string;
  • Type: string
  • Default: The branch checked out in the workflow.

Sets the pull request base branch.


branchNameOptional ​
public readonly branchName: string;
  • Type: string
  • Default: github-actions/${options.workflowName}

The pull request branch name.


credentialsOptional ​
public readonly credentials: GithubCredentials;

The job credentials used to create the pull request.

Provided credentials must have permissions to create a pull request on the repository.


deleteBranchOptional ​
public readonly deleteBranch: boolean;
  • Type: boolean
  • Default: false

Whether to delete the pull request branch when the pull request is closed, mapping to the action's delete-branch input.


gitIdentityOptional ​
public readonly gitIdentity: GitIdentity;
  • Type: GitIdentity
  • Default: default GitHub Actions user

The git identity used to create the commit.


labelsOptional ​
public readonly labels: string[];
  • Type: string[]
  • Default: no labels.

Labels to apply on the PR.


signoffOptional ​
public readonly signoff: boolean;
  • Type: boolean
  • Default: true

Add Signed-off-by line by the committer at the end of the commit log message.


stepIdOptional ​
public readonly stepId: string;
  • Type: string
  • Default: "create_pr"

The step ID which produces the output which indicates if a patch was created.


stepNameOptional ​
public readonly stepName: string;
  • Type: string
  • Default: "Create Pull Request"

The name of the step displayed on GitHub.


patchRequired ​
public readonly patch: PullRequestPatchSource;

Information about the patch that is used to create the pull request.


jobNameOptional ​
public readonly jobName: string;
  • Type: string
  • Default: "Create Pull Request"

The name of the job displayed on GitHub.


runsOnOptional ​
public readonly runsOn: string[];
  • Type: string[]
  • Default: ["ubuntu-latest"]

Github Runner selection labels.


runsOnGroupOptional ​
public readonly runsOnGroup: GroupRunnerOptions;
  • Type: projen.GroupRunnerOptions

Github Runner Group selection options.


PullRequestLintOptions ​

Options for PullRequestLint.

Initializer ​

import { github } from 'projen'

const pullRequestLintOptions: github.PullRequestLintOptions = { ... }

Properties ​

NameTypeDescription
runsOn
string[]Github Runner selection labels.
runsOnGroup
projen.GroupRunnerOptionsGithub Runner Group selection options.
contributorStatement
stringRequire a contributor statement to be included in the PR description.
contributorStatementOptions
ContributorStatementOptions
Options for requiring a contributor statement on Pull Requests.
semanticTitle
booleanValidate that pull request titles follow Conventional Commits.
semanticTitleOptions
SemanticTitleOptions
Options for validating the conventional commit title linter.

runsOnOptional ​
public readonly runsOn: string[];
  • Type: string[]
  • Default: ["ubuntu-latest"]

Github Runner selection labels.


runsOnGroupOptional ​
public readonly runsOnGroup: GroupRunnerOptions;
  • Type: projen.GroupRunnerOptions

Github Runner Group selection options.


contributorStatementOptional ​
public readonly contributorStatement: string;
  • Type: string
  • Default: no contributor statement is required

Require a contributor statement to be included in the PR description.

For example confirming that the contribution has been made by the contributor and complies with the project's license.

Appends the statement to the end of the Pull Request template.


contributorStatementOptionsOptional ​
public readonly contributorStatementOptions: ContributorStatementOptions;

Options for requiring a contributor statement on Pull Requests.


semanticTitleOptional ​
public readonly semanticTitle: boolean;
  • Type: boolean
  • Default: true

Validate that pull request titles follow Conventional Commits.

https://www.conventionalcommits.org/


semanticTitleOptionsOptional ​
public readonly semanticTitleOptions: SemanticTitleOptions;

Options for validating the conventional commit title linter.


PullRequestPatchSource ​

Initializer ​

import { github } from 'projen'

const pullRequestPatchSource: github.PullRequestPatchSource = { ... }

Properties ​

NameTypeDescription
fetchDepth
numberNumber of commits to fetch.
lfs
booleanWhether LFS is enabled for the GitHub repository.
path
stringRelative path under $GITHUB_WORKSPACE to place the repository.
ref
stringBranch or tag name.
repository
stringThe repository (owner/repo) to use.
submodules
CheckoutSubmodules
Whether to checkout Git submodules.
token
stringA GitHub token to use when checking out the repository.
patchFile
stringThe name of the artifact the patch is stored as.
jobId
stringThe id of the job that created the patch file.
outputName
stringThe name of the output that indicates if a patch has been created.

fetchDepthOptional ​
public readonly fetchDepth: number;
  • Type: number
  • Default: 1

Number of commits to fetch.

0 indicates all history for all branches and tags.


lfsOptional ​
public readonly lfs: boolean;
  • Type: boolean
  • Default: false

Whether LFS is enabled for the GitHub repository.


pathOptional ​
public readonly path: string;
  • Type: string
  • Default: $GITHUB_WORKSPACE

Relative path under $GITHUB_WORKSPACE to place the repository.


refOptional ​
public readonly ref: string;
  • Type: string
  • Default: the default branch is implicitly used

Branch or tag name.


repositoryOptional ​
public readonly repository: string;
  • Type: string
  • Default: the default repository is implicitly used

The repository (owner/repo) to use.


submodulesOptional ​
public readonly submodules: CheckoutSubmodules;

Whether to checkout Git submodules.


tokenOptional ​
public readonly token: string;
  • Type: string
  • Default: the default GITHUB_TOKEN is implicitly used

A GitHub token to use when checking out the repository.

If the intent is to push changes back to the branch, then you must use a PAT with repo (and possibly workflows) permissions.


patchFileOptional ​
public readonly patchFile: string;
  • Type: string
  • Default: ".repo.patch"

The name of the artifact the patch is stored as.


jobIdRequired ​
public readonly jobId: string;
  • Type: string

The id of the job that created the patch file.


outputNameRequired ​
public readonly outputName: string;
  • Type: string

The name of the output that indicates if a patch has been created.


PullRequestSourceBranchOptions ​

Options for PullRequestSource.fromBranch.

Initializer ​

import { github } from 'projen'

const pullRequestSourceBranchOptions: github.PullRequestSourceBranchOptions = { ... }

Properties ​

NameTypeDescription
authors
string[]The GitHub usernames that may author the pull request.
branch
stringThe exact branch the pull request comes from.
branchPrefix
stringA prefix the branch the pull request comes from must start with.
targetBranches
string[]The branches the pull request may target.

authorsOptional ​
public readonly authors: string[];
  • Type: string[]
  • Default: any author

The GitHub usernames that may author the pull request.


branchOptional ​
public readonly branch: string;
  • Type: string
  • Default: use branchPrefix

The exact branch the pull request comes from.


branchPrefixOptional ​
public readonly branchPrefix: string;
  • Type: string
  • Default: use branch

A prefix the branch the pull request comes from must start with.

Make sure to include a separator at the end like / or -.


targetBranchesOptional ​
public readonly targetBranches: string[];
  • Type: string[]
  • Default: any target branch

The branches the pull request may target.


PullRequestSourceUsersOptions ​

Options for PullRequestSource.fromUsers.

Initializer ​

import { github } from 'projen'

const pullRequestSourceUsersOptions: github.PullRequestSourceUsersOptions = { ... }

Properties ​

NameTypeDescription
logins
string[]The GitHub usernames that may author the pull request.

loginsRequired ​
public readonly logins: string[];
  • Type: string[]

The GitHub usernames that may author the pull request.


PullRequestTemplateOptions ​

Options for PullRequestTemplate.

Initializer ​

import { github } from 'projen'

const pullRequestTemplateOptions: github.PullRequestTemplateOptions = { ... }

Properties ​

NameTypeDescription
lines
string[]The contents of the template.

linesOptional ​
public readonly lines: string[];
  • Type: string[]
  • Default: a standard default template will be created.

The contents of the template.

You can use addLine() to add additional lines.


SemanticTitleOptions ​

Options for linting that PR titles follow Conventional Commits.

https://www.conventionalcommits.org/

Initializer ​

import { github } from 'projen'

const semanticTitleOptions: github.SemanticTitleOptions = { ... }

Properties ​

NameTypeDescription
requireScope
booleanConfigure that a scope must always be provided.
scopes
string[]Configure which scopes are allowed (newline-delimited).
types
string[]Configure a list of commit types that are allowed.

requireScopeOptional ​
public readonly requireScope: boolean;
  • Type: boolean
  • Default: false

Configure that a scope must always be provided.

e.g. feat(ui), fix(core)


scopesOptional ​
public readonly scopes: string[];
  • Type: string[]
  • Default: all scopes allowed

Configure which scopes are allowed (newline-delimited).

These are regex patterns auto-wrapped in ^ $.


typesOptional ​
public readonly types: string[];
  • Type: string[]
  • Default: ["feat", "fix", "chore"]

Configure a list of commit types that are allowed.


SetupGitIdentityOptions ​

Initializer ​

import { github } from 'projen'

const setupGitIdentityOptions: github.SetupGitIdentityOptions = { ... }

Properties ​

NameTypeDescription
env
{[ key: string ]: string}Sets environment variables for steps to use in the runner environment.
id
stringA unique identifier for the step.
if
stringYou can use the if conditional to prevent a job from running unless a condition is met.
name
stringA name for your step to display on GitHub.
shell
stringOverrides the default shell settings in the runner's operating system and the job's default.
workingDirectory
stringSpecifies a working directory for a step.
background
booleanRuns a step asynchronously so the job continues to the next step without waiting for it to finish.
cancel
stringGracefully terminates a running background step, referenced by its id.
continueOnError
booleanPrevents a job from failing when a step fails.
parallel
JobStep[]
Runs a group of steps concurrently, then waits for all of them to finish before continuing.
timeoutMinutes
numberThe maximum number of minutes to run the step before killing the process.
wait
string[]Pauses the job until one or more background steps complete. Provide the ids of the background steps to wait for.
waitAll
booleanPauses the job until all active background steps complete.
gitIdentity
GitIdentity
The identity to use.

envOptional ​
public readonly env: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

Sets environment variables for steps to use in the runner environment.

You can also set environment variables for the entire workflow or a job.


idOptional ​
public readonly id: string;
  • Type: string

A unique identifier for the step.

You can use the id to reference the step in contexts.


ifOptional ​
public readonly if: string;
  • Type: string

You can use the 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.


nameOptional ​
public readonly name: string;
  • Type: string

A name for your step to display on GitHub.


shellOptional ​
public readonly shell: string;
  • Type: string

Overrides the default shell settings in the runner's operating system and the job's default.

Refer to GitHub documentation for allowed values.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell


workingDirectoryOptional ​
public readonly workingDirectory: string;
  • Type: string

Specifies a working directory for a step.

Overrides a job's working directory.


backgroundOptional ​
public readonly background: boolean;
  • Type: boolean

Runs a step asynchronously so the job continues to the next step without waiting for it to finish.

Use for long-running processes, such as databases, servers, or monitoring tasks, that need to run alongside other steps.

Synchronize with background steps later using wait or waitAll, or stop them with cancel. Give the step an id so it can be referenced.

A maximum of 10 background steps can run concurrently in a single job; additional background steps are queued until a slot is free.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsbackground


cancelOptional ​
public readonly cancel: string;
  • Type: string

Gracefully terminates a running background step, referenced by its id.

The runner sends the step's process a termination signal (SIGTERM) so it can clean up, and forcibly stops it (SIGKILL) if it does not exit within a short grace period.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepscancel


continueOnErrorOptional ​
public readonly continueOnError: boolean;
  • Type: boolean

Prevents a job from failing when a step fails.

Set to true to allow a job to pass when this step fails.


parallelOptional ​
public readonly parallel: JobStep[];

Runs a group of steps concurrently, then waits for all of them to finish before continuing.

This is shorthand for declaring each step with background: true followed by a wait step.

Use this when you have a self-contained group of independent steps that can all run at the same time and don't need to be referenced individually. Use background instead when you need finer control, such as starting a long-running process that stays up while later steps run.

Each step in the group is subject to the same 10-step concurrency limit as other background steps. Cannot be used inside a composite action.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsparallel


timeoutMinutesOptional ​
public readonly timeoutMinutes: number;
  • Type: number

The maximum number of minutes to run the step before killing the process.


waitOptional ​
public readonly wait: string[];
  • Type: string[]

Pauses the job until one or more background steps complete. Provide the ids of the background steps to wait for.

This step performs no work itself; it only blocks until the referenced background steps finish. If a referenced background step failed, the wait step fails too.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswait


waitAllOptional ​
public readonly waitAll: boolean;
  • Type: boolean

Pauses the job until all active background steps complete.

Fails if any of the background steps it waits on failed, unless continueOnError is set on this step.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswait-all


gitIdentityRequired ​
public readonly gitIdentity: GitIdentity;

The identity to use.


StaleBehavior ​

Stale behavior.

Initializer ​

import { github } from 'projen'

const staleBehavior: github.StaleBehavior = { ... }

Properties ​

NameTypeDescription
closeMessage
stringThe comment to add to the issue/PR when it's closed.
daysBeforeClose
numberDays until the issue/PR is closed after it is marked as "Stale".
daysBeforeStale
numberHow many days until the issue or pull request is marked as "Stale".
enabled
booleanDetermines if this behavior is enabled.
exemptLabels
string[]Label which exempt an issue/PR from becoming stale.
staleLabel
stringThe label to apply to the issue/PR when it becomes stale.
staleMessage
stringThe comment to add to the issue/PR when it becomes stale.

closeMessageOptional ​
public readonly closeMessage: string;
  • Type: string
  • Default: "Closing this pull request as it hasn't seen activity for a while. Please add a comment

The comment to add to the issue/PR when it's closed.


daysBeforeCloseOptional ​
public readonly daysBeforeClose: number;
  • Type: number
  • Default:

Days until the issue/PR is closed after it is marked as "Stale".

Set to -1 to disable.


daysBeforeStaleOptional ​
public readonly daysBeforeStale: number;
  • Type: number
  • Default:

How many days until the issue or pull request is marked as "Stale".

Set to -1 to disable.


enabledOptional ​
public readonly enabled: boolean;
  • Type: boolean
  • Default: true

Determines if this behavior is enabled.

Same as setting daysBeforeStale and daysBeforeClose to -1.


exemptLabelsOptional ​
public readonly exemptLabels: string[];
  • Type: string[]
  • Default: ["backlog"]

Label which exempt an issue/PR from becoming stale.

Set to [] to disable.


staleLabelOptional ​
public readonly staleLabel: string;
  • Type: string
  • Default: "stale"

The label to apply to the issue/PR when it becomes stale.


staleMessageOptional ​
public readonly staleMessage: string;
  • Type: string
  • Default: "This pull request is now marked as stale because hasn't seen activity for a while. Add a comment or it will be closed soon."

The comment to add to the issue/PR when it becomes stale.


StaleOptions ​

Options for Stale.

Initializer ​

import { github } from 'projen'

const staleOptions: github.StaleOptions = { ... }

Properties ​

NameTypeDescription
runsOn
string[]Github Runner selection labels.
runsOnGroup
projen.GroupRunnerOptionsGithub Runner Group selection options.
issues
StaleBehavior
How to handle stale issues.
pullRequest
StaleBehavior
How to handle stale pull requests.

runsOnOptional ​
public readonly runsOn: string[];
  • Type: string[]
  • Default: ["ubuntu-latest"]

Github Runner selection labels.


runsOnGroupOptional ​
public readonly runsOnGroup: GroupRunnerOptions;
  • Type: projen.GroupRunnerOptions

Github Runner Group selection options.


issuesOptional ​
public readonly issues: StaleBehavior;
  • Type: StaleBehavior
  • Default: By default, stale issues with no activity will be marked as stale after 60 days and closed within 7 days.

How to handle stale issues.


pullRequestOptional ​
public readonly pullRequest: StaleBehavior;
  • Type: StaleBehavior
  • Default: By default, pull requests with no activity will be marked as stale after 14 days and closed within 2 days with relevant comments.

How to handle stale pull requests.


TaskWorkflowJobOptions ​

Options to create the Job associated with a TaskWorkflow.

Initializer ​

import { github } from 'projen'

const taskWorkflowJobOptions: github.TaskWorkflowJobOptions = { ... }

Properties ​

NameTypeDescription
permissions
JobPermissions
Permissions for the build job.
artifactsDirectory
stringA directory name which contains artifacts to be uploaded (e.g. dist). If this is set, the contents of this directory will be uploaded as an artifact at the end of the workflow run, even if other steps fail.
checkoutSubmodules
CheckoutSubmodules
Whether to checkout Git submodules.
checkoutWith
CheckoutWith
Override for the with property of the source code checkout step.
condition
stringAdds an 'if' condition to the workflow.
container
ContainerOptions
No description.
downloadLfs
booleanWhether to download files from Git LFS for this workflow.
env
{[ key: string ]: string}Workflow environment variables.
environment
stringThe GitHub Actions environment used for the job.
gitIdentity
GitIdentity
The git identity to use in this workflow.
jobDefaults
JobDefaults
Default settings for all steps in the TaskWorkflow Job.
outputs
{[ key: string ]: JobStepOutput}
Mapping of job output names to values/expressions.
postBuildSteps
JobStep[]
Actions to run after the main build step.
preBuildSteps
JobStep[]
Steps to run before the main build step.
preCheckoutSteps
JobStep[]
Initial steps to run before the source code checkout.
runsOn
string[]Github Runner selection labels.
runsOnGroup
projen.GroupRunnerOptionsGithub Runner Group selection options.

permissionsRequired ​
public readonly permissions: JobPermissions;

Permissions for the build job.


artifactsDirectoryOptional ​
public readonly artifactsDirectory: string;
  • Type: string
  • Default: not set

A directory name which contains artifacts to be uploaded (e.g. dist). If this is set, the contents of this directory will be uploaded as an artifact at the end of the workflow run, even if other steps fail.


checkoutSubmodulesOptional ​
public readonly checkoutSubmodules: CheckoutSubmodules;

Whether to checkout Git submodules.


checkoutWithOptional ​
public readonly checkoutWith: CheckoutWith;

Override for the with property of the source code checkout step.


conditionOptional ​
public readonly condition: string;
  • Type: string

Adds an 'if' condition to the workflow.


containerOptional ​
public readonly container: ContainerOptions;

downloadLfsOptional ​
public readonly downloadLfs: boolean;
  • Type: boolean
  • Default: Use the setting on the corresponding GitHub project

Whether to download files from Git LFS for this workflow.


envOptional ​
public readonly env: {[ key: string ]: string};
  • Type: {[ key: string ]: string}
  • Default: {}

Workflow environment variables.


environmentOptional ​
public readonly environment: string;
  • Type: string
  • Default: no environment used

The GitHub Actions environment used for the job.


gitIdentityOptional ​
public readonly gitIdentity: GitIdentity;
  • Type: GitIdentity
  • Default: default GitHub Actions user

The git identity to use in this workflow.


jobDefaultsOptional ​
public readonly jobDefaults: JobDefaults;

Default settings for all steps in the TaskWorkflow Job.


outputsOptional ​
public readonly outputs: {[ key: string ]: JobStepOutput};

Mapping of job output names to values/expressions.


postBuildStepsOptional ​
public readonly postBuildSteps: JobStep[];

Actions to run after the main build step.


preBuildStepsOptional ​
public readonly preBuildSteps: JobStep[];

Steps to run before the main build step.


preCheckoutStepsOptional ​
public readonly preCheckoutSteps: JobStep[];

Initial steps to run before the source code checkout.


runsOnOptional ​
public readonly runsOn: string[];
  • Type: string[]
  • Default: ["ubuntu-latest"]

Github Runner selection labels.


runsOnGroupOptional ​
public readonly runsOnGroup: GroupRunnerOptions;
  • Type: projen.GroupRunnerOptions

Github Runner Group selection options.


TaskWorkflowOptions ​

Options to create a TaskWorkflow.

Initializer ​

import { github } from 'projen'

const taskWorkflowOptions: github.TaskWorkflowOptions = { ... }

Properties ​

NameTypeDescription
permissions
JobPermissions
Permissions for the build job.
artifactsDirectory
stringA directory name which contains artifacts to be uploaded (e.g. dist). If this is set, the contents of this directory will be uploaded as an artifact at the end of the workflow run, even if other steps fail.
checkoutSubmodules
CheckoutSubmodules
Whether to checkout Git submodules.
checkoutWith
CheckoutWith
Override for the with property of the source code checkout step.
condition
stringAdds an 'if' condition to the workflow.
container
ContainerOptions
No description.
downloadLfs
booleanWhether to download files from Git LFS for this workflow.
env
{[ key: string ]: string}Workflow environment variables.
environment
stringThe GitHub Actions environment used for the job.
gitIdentity
GitIdentity
The git identity to use in this workflow.
jobDefaults
JobDefaults
Default settings for all steps in the TaskWorkflow Job.
outputs
{[ key: string ]: JobStepOutput}
Mapping of job output names to values/expressions.
postBuildSteps
JobStep[]
Actions to run after the main build step.
preBuildSteps
JobStep[]
Steps to run before the main build step.
preCheckoutSteps
JobStep[]
Initial steps to run before the source code checkout.
runsOn
string[]Github Runner selection labels.
runsOnGroup
projen.GroupRunnerOptionsGithub Runner Group selection options.
name
stringThe workflow name.
task
projen.TaskThe main task to be executed.
jobId
stringThe primary job id.
triggers
Triggers
The triggers for the workflow.

permissionsRequired ​
public readonly permissions: JobPermissions;

Permissions for the build job.


artifactsDirectoryOptional ​
public readonly artifactsDirectory: string;
  • Type: string
  • Default: not set

A directory name which contains artifacts to be uploaded (e.g. dist). If this is set, the contents of this directory will be uploaded as an artifact at the end of the workflow run, even if other steps fail.


checkoutSubmodulesOptional ​
public readonly checkoutSubmodules: CheckoutSubmodules;

Whether to checkout Git submodules.


checkoutWithOptional ​
public readonly checkoutWith: CheckoutWith;

Override for the with property of the source code checkout step.


conditionOptional ​
public readonly condition: string;
  • Type: string

Adds an 'if' condition to the workflow.


containerOptional ​
public readonly container: ContainerOptions;

downloadLfsOptional ​
public readonly downloadLfs: boolean;
  • Type: boolean
  • Default: Use the setting on the corresponding GitHub project

Whether to download files from Git LFS for this workflow.


envOptional ​
public readonly env: {[ key: string ]: string};
  • Type: {[ key: string ]: string}
  • Default: {}

Workflow environment variables.


environmentOptional ​
public readonly environment: string;
  • Type: string
  • Default: no environment used

The GitHub Actions environment used for the job.


gitIdentityOptional ​
public readonly gitIdentity: GitIdentity;
  • Type: GitIdentity
  • Default: default GitHub Actions user

The git identity to use in this workflow.


jobDefaultsOptional ​
public readonly jobDefaults: JobDefaults;

Default settings for all steps in the TaskWorkflow Job.


outputsOptional ​
public readonly outputs: {[ key: string ]: JobStepOutput};

Mapping of job output names to values/expressions.


postBuildStepsOptional ​
public readonly postBuildSteps: JobStep[];

Actions to run after the main build step.


preBuildStepsOptional ​
public readonly preBuildSteps: JobStep[];

Steps to run before the main build step.


preCheckoutStepsOptional ​
public readonly preCheckoutSteps: JobStep[];

Initial steps to run before the source code checkout.


runsOnOptional ​
public readonly runsOn: string[];
  • Type: string[]
  • Default: ["ubuntu-latest"]

Github Runner selection labels.


runsOnGroupOptional ​
public readonly runsOnGroup: GroupRunnerOptions;
  • Type: projen.GroupRunnerOptions

Github Runner Group selection options.


nameRequired ​
public readonly name: string;
  • Type: string

The workflow name.


taskRequired ​
public readonly task: Task;
  • Type: projen.Task

The main task to be executed.


jobIdOptional ​
public readonly jobId: string;
  • Type: string
  • Default: "build"

The primary job id.


triggersOptional ​
public readonly triggers: Triggers;
  • Type: Triggers
  • Default: by default workflows can only be triggered by manually.

The triggers for the workflow.


UploadArtifactOptions ​

Initializer ​

import { github } from 'projen'

const uploadArtifactOptions: github.UploadArtifactOptions = { ... }

Properties ​

NameTypeDescription
env
{[ key: string ]: string}Sets environment variables for steps to use in the runner environment.
id
stringA unique identifier for the step.
if
stringYou can use the if conditional to prevent a job from running unless a condition is met.
name
stringA name for your step to display on GitHub.
shell
stringOverrides the default shell settings in the runner's operating system and the job's default.
workingDirectory
stringSpecifies a working directory for a step.
background
booleanRuns a step asynchronously so the job continues to the next step without waiting for it to finish.
cancel
stringGracefully terminates a running background step, referenced by its id.
continueOnError
booleanPrevents a job from failing when a step fails.
parallel
JobStep[]
Runs a group of steps concurrently, then waits for all of them to finish before continuing.
timeoutMinutes
numberThe maximum number of minutes to run the step before killing the process.
wait
string[]Pauses the job until one or more background steps complete. Provide the ids of the background steps to wait for.
waitAll
booleanPauses the job until all active background steps complete.
with
UploadArtifactWith
Options for upload-artifact.

envOptional ​
public readonly env: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

Sets environment variables for steps to use in the runner environment.

You can also set environment variables for the entire workflow or a job.


idOptional ​
public readonly id: string;
  • Type: string

A unique identifier for the step.

You can use the id to reference the step in contexts.


ifOptional ​
public readonly if: string;
  • Type: string

You can use the 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.


nameOptional ​
public readonly name: string;
  • Type: string

A name for your step to display on GitHub.


shellOptional ​
public readonly shell: string;
  • Type: string

Overrides the default shell settings in the runner's operating system and the job's default.

Refer to GitHub documentation for allowed values.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell


workingDirectoryOptional ​
public readonly workingDirectory: string;
  • Type: string

Specifies a working directory for a step.

Overrides a job's working directory.


backgroundOptional ​
public readonly background: boolean;
  • Type: boolean

Runs a step asynchronously so the job continues to the next step without waiting for it to finish.

Use for long-running processes, such as databases, servers, or monitoring tasks, that need to run alongside other steps.

Synchronize with background steps later using wait or waitAll, or stop them with cancel. Give the step an id so it can be referenced.

A maximum of 10 background steps can run concurrently in a single job; additional background steps are queued until a slot is free.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsbackground


cancelOptional ​
public readonly cancel: string;
  • Type: string

Gracefully terminates a running background step, referenced by its id.

The runner sends the step's process a termination signal (SIGTERM) so it can clean up, and forcibly stops it (SIGKILL) if it does not exit within a short grace period.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepscancel


continueOnErrorOptional ​
public readonly continueOnError: boolean;
  • Type: boolean

Prevents a job from failing when a step fails.

Set to true to allow a job to pass when this step fails.


parallelOptional ​
public readonly parallel: JobStep[];

Runs a group of steps concurrently, then waits for all of them to finish before continuing.

This is shorthand for declaring each step with background: true followed by a wait step.

Use this when you have a self-contained group of independent steps that can all run at the same time and don't need to be referenced individually. Use background instead when you need finer control, such as starting a long-running process that stays up while later steps run.

Each step in the group is subject to the same 10-step concurrency limit as other background steps. Cannot be used inside a composite action.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsparallel


timeoutMinutesOptional ​
public readonly timeoutMinutes: number;
  • Type: number

The maximum number of minutes to run the step before killing the process.


waitOptional ​
public readonly wait: string[];
  • Type: string[]

Pauses the job until one or more background steps complete. Provide the ids of the background steps to wait for.

This step performs no work itself; it only blocks until the referenced background steps finish. If a referenced background step failed, the wait step fails too.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswait


waitAllOptional ​
public readonly waitAll: boolean;
  • Type: boolean

Pauses the job until all active background steps complete.

Fails if any of the background steps it waits on failed, unless continueOnError is set on this step.

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswait-all


withRequired ​
public readonly with: UploadArtifactWith;

Options for upload-artifact.


UploadArtifactWith ​

Initializer ​

import { github } from 'projen'

const uploadArtifactWith: github.UploadArtifactWith = { ... }

Properties ​

NameTypeDescription
path
stringA file, directory or wildcard pattern that describes what to upload.
compressionLevel
numberThe level of compression for Zlib to be applied to the artifact archive.
ifNoFilesFound
stringThe desired behavior if no files are found using the provided path.
includeHiddenFiles
booleanWhether to include hidden files in the provided path in the artifact.
name
stringName of the artifact to upload.
overwrite
booleanWhether action should overwrite an existing artifact with the same name (should one exist).
retentionDays
numberDuration after which artifact will expire in days. 0 means using default repository retention.

pathRequired ​
public readonly path: string;
  • Type: string

A file, directory or wildcard pattern that describes what to upload.


compressionLevelOptional ​
public readonly compressionLevel: number;
  • Type: number
  • Default: 6

The level of compression for Zlib to be applied to the artifact archive.

The value can range from 0 to 9. For large files that are not easily compressed, a value of 0 is recommended for significantly faster uploads.


ifNoFilesFoundOptional ​
public readonly ifNoFilesFound: string;
  • Type: string
  • Default: "warn"

The desired behavior if no files are found using the provided path.

Available Options: warn: Output a warning but do not fail the action error: Fail the action with an error message ignore: Do not output any warnings or errors, the action does not fail


includeHiddenFilesOptional ​
public readonly includeHiddenFiles: boolean;
  • Type: boolean
  • Default: false

Whether to include hidden files in the provided path in the artifact.

The file contents of any hidden files in the path should be validated before enabled this to avoid uploading sensitive information.


nameOptional ​
public readonly name: string;
  • Type: string
  • Default: "artifact"

Name of the artifact to upload.


overwriteOptional ​
public readonly overwrite: boolean;
  • Type: boolean
  • Default: true

Whether action should overwrite an existing artifact with the same name (should one exist).

Introduced in v4 and represents a breaking change from the behavior of the v3 action. To maintain backwards compatibility with existing, this should be set the true (the default).


retentionDaysOptional ​
public readonly retentionDays: number;
  • Type: number
  • Default: The default repository retention

Duration after which artifact will expire in days. 0 means using default repository retention.

Minimum 1 day. Maximum 90 days unless changed from the repository settings page.


UploadGitPatchOptions ​

Options for uploadGitPatch.

Initializer ​

import { github } from 'projen'

const uploadGitPatchOptions: github.UploadGitPatchOptions = { ... }

Properties ​

NameTypeDescription
outputName
stringThe name of the output to emit.
stepId
stringThe step ID which produces the output which indicates if a patch was created.
mutationError
stringFail if a mutation was found and print this error message.
patchFile
stringThe name of the artifact the patch is stored as.
stepName
stringThe name of the step.

outputNameRequired ​
public readonly outputName: string;
  • Type: string

The name of the output to emit.

It will be set to true if there was a diff.


stepIdRequired ​
public readonly stepId: string;
  • Type: string

The step ID which produces the output which indicates if a patch was created.


mutationErrorOptional ​
public readonly mutationError: string;
  • Type: string
  • Default: do not fail upon mutation

Fail if a mutation was found and print this error message.


patchFileOptional ​
public readonly patchFile: string;
  • Type: string
  • Default: ".repo.patch"

The name of the artifact the patch is stored as.


stepNameOptional ​
public readonly stepName: string;
  • Type: string
  • Default: "Find mutations"

The name of the step.


Classes ​

ActionRefs ​

Fully qualified references (owner/repo@ref) for GitHub Actions.

Use these when authoring workflow steps, so that every step references a reviewed action version.

Constants ​

NameTypeDescription
ACTIONS_CHECKOUT
stringactions/checkout at v7.0.1.
ACTIONS_CREATE_GITHUB_APP_TOKEN
stringactions/create-github-app-token at v3.2.0 (immutable).
ACTIONS_DEPENDENCY_REVIEW_ACTION
stringactions/dependency-review-action at v5.0.0.
ACTIONS_DOWNLOAD_ARTIFACT
stringactions/download-artifact at v8.0.1.
ACTIONS_GITHUB_SCRIPT
stringactions/github-script at v9.0.0.
ACTIONS_SETUP_DOTNET
stringactions/setup-dotnet at v6.0.0 (immutable).
ACTIONS_SETUP_GO
stringactions/setup-go at v7.0.0 (immutable).
ACTIONS_SETUP_JAVA
stringactions/setup-java at v6.0.0 (immutable).
ACTIONS_SETUP_NODE
stringactions/setup-node at v7.0.0 (immutable).
ACTIONS_SETUP_PYTHON
stringactions/setup-python at v7.0.0 (immutable).
ACTIONS_STALE
stringactions/stale at v11.0.0 (immutable).
ACTIONS_UPLOAD_ARTIFACT
stringactions/upload-artifact at v7.0.1.
AMANNN_ACTION_SEMANTIC_PULL_REQUEST
stringamannn/action-semantic-pull-request at v6.1.1.
AWS_ACTIONS_CONFIGURE_AWS_CREDENTIALS
stringaws-actions/configure-aws-credentials at v6.2.3 (immutable).
CODECOV_CODECOV_ACTION
stringcodecov/codecov-action at v7.0.0 (immutable).
OVEN_SH_SETUP_BUN
stringoven-sh/setup-bun at v2.2.0.
PETER_EVANS_CREATE_PULL_REQUEST
stringpeter-evans/create-pull-request at v8.1.1 (immutable).
PNPM_ACTION_SETUP
stringpnpm/action-setup at v6.0.10 (immutable).
SQREN_BACKPORT_GITHUB_ACTION
stringsqren/backport-github-action at v12.0.4.

ACTIONS_CHECKOUTRequired ​
public readonly ACTIONS_CHECKOUT: string;
  • Type: string

actions/checkout at v7.0.1.


ACTIONS_CREATE_GITHUB_APP_TOKENRequired ​
public readonly ACTIONS_CREATE_GITHUB_APP_TOKEN: string;
  • Type: string

actions/create-github-app-token at v3.2.0 (immutable).


ACTIONS_DEPENDENCY_REVIEW_ACTIONRequired ​
public readonly ACTIONS_DEPENDENCY_REVIEW_ACTION: string;
  • Type: string

actions/dependency-review-action at v5.0.0.


ACTIONS_DOWNLOAD_ARTIFACTRequired ​
public readonly ACTIONS_DOWNLOAD_ARTIFACT: string;
  • Type: string

actions/download-artifact at v8.0.1.


ACTIONS_GITHUB_SCRIPTRequired ​
public readonly ACTIONS_GITHUB_SCRIPT: string;
  • Type: string

actions/github-script at v9.0.0.


ACTIONS_SETUP_DOTNETRequired ​
public readonly ACTIONS_SETUP_DOTNET: string;
  • Type: string

actions/setup-dotnet at v6.0.0 (immutable).


ACTIONS_SETUP_GORequired ​
public readonly ACTIONS_SETUP_GO: string;
  • Type: string

actions/setup-go at v7.0.0 (immutable).


ACTIONS_SETUP_JAVARequired ​
public readonly ACTIONS_SETUP_JAVA: string;
  • Type: string

actions/setup-java at v6.0.0 (immutable).


ACTIONS_SETUP_NODERequired ​
public readonly ACTIONS_SETUP_NODE: string;
  • Type: string

actions/setup-node at v7.0.0 (immutable).


ACTIONS_SETUP_PYTHONRequired ​
public readonly ACTIONS_SETUP_PYTHON: string;
  • Type: string

actions/setup-python at v7.0.0 (immutable).


ACTIONS_STALERequired ​
public readonly ACTIONS_STALE: string;
  • Type: string

actions/stale at v11.0.0 (immutable).


ACTIONS_UPLOAD_ARTIFACTRequired ​
public readonly ACTIONS_UPLOAD_ARTIFACT: string;
  • Type: string

actions/upload-artifact at v7.0.1.


AMANNN_ACTION_SEMANTIC_PULL_REQUESTRequired ​
public readonly AMANNN_ACTION_SEMANTIC_PULL_REQUEST: string;
  • Type: string

amannn/action-semantic-pull-request at v6.1.1.


AWS_ACTIONS_CONFIGURE_AWS_CREDENTIALSRequired ​
public readonly AWS_ACTIONS_CONFIGURE_AWS_CREDENTIALS: string;
  • Type: string

aws-actions/configure-aws-credentials at v6.2.3 (immutable).


CODECOV_CODECOV_ACTIONRequired ​
public readonly CODECOV_CODECOV_ACTION: string;
  • Type: string

codecov/codecov-action at v7.0.0 (immutable).


OVEN_SH_SETUP_BUNRequired ​
public readonly OVEN_SH_SETUP_BUN: string;
  • Type: string

oven-sh/setup-bun at v2.2.0.


PETER_EVANS_CREATE_PULL_REQUESTRequired ​
public readonly PETER_EVANS_CREATE_PULL_REQUEST: string;
  • Type: string

peter-evans/create-pull-request at v8.1.1 (immutable).


PNPM_ACTION_SETUPRequired ​
public readonly PNPM_ACTION_SETUP: string;
  • Type: string

pnpm/action-setup at v6.0.10 (immutable).


SQREN_BACKPORT_GITHUB_ACTIONRequired ​
public readonly SQREN_BACKPORT_GITHUB_ACTION: string;
  • Type: string

sqren/backport-github-action at v12.0.4.


GitHubActionsProvider ​

Manage the versions used for GitHub Actions used in steps.

Initializers ​

import { github } from 'projen'

new github.GitHubActionsProvider()
NameTypeDescription

Methods ​

NameDescription
get
Resolve an action name to the version that should be used, taking into account any overrides.
set
Define an override for a given action.

get ​
public get(action: string): string

Resolve an action name to the version that should be used, taking into account any overrides.

actionRequired ​
  • Type: string

set ​
public set(action: string, override: string): void

Define an override for a given action.

Specify the action name without a version to override all usages of the action. You can also override a specific action version, by providing the version string. Specific overrides take precedence over overrides without a version.

If an override for the same action name is set multiple times, the last override is used.

Example

// Force any use of `actions/checkout` to use a pin a specific commit
project.github.actions.set("actions/checkout", "actions/checkout@aaaaaa");

// But pin usage of `v4` to a different commit
project.github.actions.set("actions/checkout@v6", "actions/checkout@ffffff");
actionRequired ​
  • Type: string

overrideRequired ​
  • Type: string

GithubCredentials ​

Represents a method of providing GitHub API access for projen workflows.

Static Functions ​

NameDescription
fromApp
Provide API access through a GitHub App.
fromPersonalAccessToken
Provide API access through a GitHub personal access token.

fromApp ​
import { github } from 'projen'

github.GithubCredentials.fromApp(options?: GithubCredentialsAppOptions)

Provide API access through a GitHub App.

The GitHub App must be installed on the GitHub repo, its App ID and a private key must be added as secrets to the repo. The name of the secrets can be specified here.

https://projen.io/docs/integrations/github/#github-app

optionsOptional ​

fromPersonalAccessToken ​
import { github } from 'projen'

github.GithubCredentials.fromPersonalAccessToken(options?: GithubCredentialsPersonalAccessTokenOptions)

Provide API access through a GitHub personal access token.

The token must be added as a secret to the GitHub repo, and the name of the secret can be specified here.

https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token

optionsOptional ​

Properties ​

NameTypeDescription
setupSteps
JobStep[]
Setup steps to obtain GitHub credentials.
tokenRef
stringThe value to use in a workflow when a GitHub token is expected.
environment
stringThe GitHub Actions environment the credentials have been added to.

setupStepsRequired ​
public readonly setupSteps: JobStep[];

Setup steps to obtain GitHub credentials.


tokenRefRequired ​
public readonly tokenRef: string;
  • Type: string

The value to use in a workflow when a GitHub token is expected.

This typically looks like "${{ some.path.to.a.value }}".


environmentOptional ​
public readonly environment: string;
  • Type: string

The GitHub Actions environment the credentials have been added to.


PullRequestSource ​

Describes where a pull request comes from.

Used to select which pull requests a workflow acts on, e.g. which pull requests are auto-approved.

Static Functions ​

NameDescription
fromBranch
Pull requests from a head branch in this repository.
fromUsers
Pull requests authored by any of the given users.

fromBranch ​
import { github } from 'projen'

github.PullRequestSource.fromBranch(options: PullRequestSourceBranchOptions)

Pull requests from a head branch in this repository.

Anyone who can push to the head branch controls the content of the pull request. Protect the matching branches with a ruleset that only allows the intended automation to create, update and delete them.

optionsRequired ​

fromUsers ​
import { github } from 'projen'

github.PullRequestSource.fromUsers(options: PullRequestSourceUsersOptions)

Pull requests authored by any of the given users.

Anyone with access to the credentials of these users can author a matching pull request.

optionsRequired ​

WorkflowActions ​

A set of utility functions for creating GitHub actions in workflows.

Initializers ​

import { github } from 'projen'

new github.WorkflowActions()
NameTypeDescription

Static Functions ​

NameDescription
checkoutWithPatch
Checks out a repository and applies a git patch that was created using uploadGitPatch.
createPullRequest
A step that creates a pull request based on the current repo state.
uploadGitPatch
Creates a .patch file from the current git diff and uploads it as an artifact. Use checkoutWithPatch to download and apply in another job.

checkoutWithPatch ​
import { github } from 'projen'

github.WorkflowActions.checkoutWithPatch(options?: CheckoutWithPatchOptions)

Checks out a repository and applies a git patch that was created using uploadGitPatch.

optionsOptional ​

Options.


createPullRequest ​
import { github } from 'projen'

github.WorkflowActions.createPullRequest(options: CreatePullRequestOptions)

A step that creates a pull request based on the current repo state.

optionsRequired ​

Options.


uploadGitPatch ​
import { github } from 'projen'

github.WorkflowActions.uploadGitPatch(options: UploadGitPatchOptions)

Creates a .patch file from the current git diff and uploads it as an artifact. Use checkoutWithPatch to download and apply in another job.

If a patch was uploaded, the action can optionally fail the job.

optionsRequired ​

Options.


WorkflowJobs ​

A set of utility functions for creating jobs in GitHub Workflows.

Initializers ​

import { github } from 'projen'

new github.WorkflowJobs()
NameTypeDescription

Static Functions ​

NameDescription
pullRequestFromPatch
Creates a pull request with the changes of a patch file.

pullRequestFromPatch ​
import { github } from 'projen'

github.WorkflowJobs.pullRequestFromPatch(options: PullRequestFromPatchOptions)

Creates a pull request with the changes of a patch file.

optionsRequired ​

WorkflowSteps ​

A collection of very commonly used, individual, GitHub Workflow Job steps.

Initializers ​

import { github } from 'projen'

new github.WorkflowSteps()
NameTypeDescription

Static Functions ​

NameDescription
checkout
Checks out a repository.
downloadArtifact
Downloads an artifact.
setupGitIdentity
Configures the git identity (user name and email).
tagExists
Checks if a tag exists.
uploadArtifact
Uploads an artifact.

checkout ​
import { github } from 'projen'

github.WorkflowSteps.checkout(options?: CheckoutOptions)

Checks out a repository.

optionsOptional ​

Options to configure the checkout JobStep.


downloadArtifact ​
import { github } from 'projen'

github.WorkflowSteps.downloadArtifact(options?: DownloadArtifactOptions)

Downloads an artifact.

optionsOptional ​

Options to configure the download-artifact JobStep.


setupGitIdentity ​
import { github } from 'projen'

github.WorkflowSteps.setupGitIdentity(options: SetupGitIdentityOptions)

Configures the git identity (user name and email).

optionsRequired ​

Options to configure the git identity JobStep.


tagExists ​
import { github } from 'projen'

github.WorkflowSteps.tagExists(tag: string, options: JobStepConfiguration)

Checks if a tag exists.

Requires a checkout step to have been run before this step with "fetch-depth" set to "0".

Outputs:

  • exists: A string value of 'true' or 'false' indicating if the tag exists.
tagRequired ​
  • Type: string

The tag to check.

You may use valid bash code instead of a literal string in this field.


optionsRequired ​

Options to configure the tag-exists JobStep.


uploadArtifact ​
import { github } from 'projen'

github.WorkflowSteps.uploadArtifact(options: UploadArtifactOptions)

Uploads an artifact.

optionsRequired ​

Options to configure the upload-artifact JobStep.


Protocols ​

IAddConditionsLater ​

Methods ​

NameDescription
render
No description.

render ​
public render(): string[]

Enums ​

CheckoutSubmodules ​

Whether to checkout Git submodules in CI workflows.

Members ​

NameDescription
DISABLED
Don't checkout submodules.
ENABLED
Checkout only top-level submodules.
RECURSIVE
Checkout submodules recursively.

DISABLED ​

Don't checkout submodules.


ENABLED ​

Checkout only top-level submodules.


RECURSIVE ​

Checkout submodules recursively.


DependabotGroupAppliesTo ​

The type of update a group applies to.

Members ​

NameDescription
VERSION_UPDATES
Apply only to version updates.
SECURITY_UPDATES
Apply only to security updates.

VERSION_UPDATES ​

Apply only to version updates.


SECURITY_UPDATES ​

Apply only to security updates.


DependabotGroupDependencyType ​

The type of dependency a group may be limited to.

Members ​

NameDescription
DEVELOPMENT
Include only dependencies in the "Development dependency group".
PRODUCTION
Include only dependencies in the "Production dependency group".

DEVELOPMENT ​

Include only dependencies in the "Development dependency group".


PRODUCTION ​

Include only dependencies in the "Production dependency group".


DependabotGroupUpdateType ​

The semantic versioning levels a group may be limited to.

Members ​

NameDescription
MAJOR
Include major releases.
MINOR
Include minor releases.
PATCH
Include patch releases.

MAJOR ​

Include major releases.


MINOR ​

Include minor releases.


PATCH ​

Include patch releases.


DependabotRegistryType ​

Each configuration type requires you to provide particular settings.

Some types allow more than one way to connect

https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#configuration-options-for-private-registries

Members ​

NameDescription
COMPOSER_REGISTRY
The composer-repository type supports username and password.
DOCKER_REGISTRY
The docker-registry type supports username and password.
GIT
The git type supports username and password.
HEX_ORGANIZATION
The hex-organization type supports organization and key.
MAVEN_REPOSITORY
The maven-repository type supports username and password, or token.
NPM_REGISTRY
The npm-registry type supports username and password, or token.
NUGET_FEED
The nuget-feed type supports username and password, or token.
PYTHON_INDEX
The python-index type supports username and password, or token.
RUBYGEMS_SERVER
The rubygems-server type supports username and password, or token.
TERRAFORM_REGISTRY
The terraform-registry type supports a token.

COMPOSER_REGISTRY ​

The composer-repository type supports username and password.

https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#composer-repository


DOCKER_REGISTRY ​

The docker-registry type supports username and password.

The docker-registry type can also be used to pull from Amazon ECR using static AWS credentials

https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#docker-registry


GIT ​

The git type supports username and password.

https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#git


HEX_ORGANIZATION ​

The hex-organization type supports organization and key.

https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#hex-organization


MAVEN_REPOSITORY ​

The maven-repository type supports username and password, or token.

https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#maven-repository


NPM_REGISTRY ​

The npm-registry type supports username and password, or token.

https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#npm-registry


NUGET_FEED ​

The nuget-feed type supports username and password, or token.

https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#nuget-feed


PYTHON_INDEX ​

The python-index type supports username and password, or token.

https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#python-index


RUBYGEMS_SERVER ​

The rubygems-server type supports username and password, or token.

https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#rubygems-server


TERRAFORM_REGISTRY ​

The terraform-registry type supports a token.

https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#terraform-registry


DependabotScheduleInterval ​

How often to check for new versions and raise pull requests for version updates.

Members ​

NameDescription
DAILY
Runs on every weekday, Monday to Friday.
WEEKLY
Runs once each week.
MONTHLY
Runs once each month.

DAILY ​

Runs on every weekday, Monday to Friday.


WEEKLY ​

Runs once each week.

By default, this is on Monday.


MONTHLY ​

Runs once each month.

This is on the first day of the month.


MergeMethod ​

The merge method used to add the PR to the merge queue.

Behavior can be further configured in repository settings.

Members ​

NameDescription
SQUASH
No description.
MERGE
No description.
REBASE
No description.

SQUASH ​

MERGE ​

REBASE ​

VersioningStrategy ​

The strategy to use when edits manifest and lock files.

Members ​

NameDescription
LOCKFILE_ONLY
Only create pull requests to update lockfiles updates.
AUTO
- For apps, the version requirements are increased.
WIDEN
Relax the version requirement to include both the new and old version, when possible.
INCREASE
Always increase the version requirement to match the new version.
INCREASE_IF_NECESSARY
Increase the version requirement only when required by the new version.

LOCKFILE_ONLY ​

Only create pull requests to update lockfiles updates.

Ignore any new versions that would require package manifest changes.


AUTO ​

For apps, the version requirements are increased.

For libraries, the range of versions is widened.


WIDEN ​

Relax the version requirement to include both the new and old version, when possible.


INCREASE ​

Always increase the version requirement to match the new version.


INCREASE_IF_NECESSARY ​

Increase the version requirement only when required by the new version.