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.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

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.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

Sets up mergify to merging approved pull requests.

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.

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.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
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.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

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.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

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.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
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.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

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,.


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.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.
addDependabot
No description.
addPullRequestTemplate
No description.
addWorkflow
Adds a workflow to the project.
tryFindWorkflow
Finds a GitHub workflow by name.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

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.


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.
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.


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.
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.
addTip
Prints a "tip" message during synthesis.
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.
tryFindJsonFile
Finds a json file by name.
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.

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.


addTip
public addTip(message: string): void

Prints a "tip" message during synthesis.

messageRequired
  • Type: string

The message.


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 "postSynthesize()" for all components of this project
  6. Call "this.postSynthesize()"
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.


tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile

Finds a json file by name.

filePathRequired
  • Type: string

The file path.


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.
projectType
projen.ProjectTypeNo description.
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: 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 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.


projectTypeRequired
  • 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 projectType: ProjectType;
  • Type: projen.ProjectType

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.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.
addJob
Adds a single job to the workflow.
addJobs
Add jobs to the workflow.
getJob
Get a single job from the workflow.
on
Add events to triggers the workflow.
removeJob
Removes a single job to the workflow.
updateJob
Updates a single job to the workflow.
updateJobs
Updates jobs for this worklow Does a complete replace, it does not try to merge the jobs.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

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.


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

Get a single job from the workflow.

idRequired
  • Type: string

The job name (unique within the workflow).


on
public on(events: Triggers): void

Add events to triggers the workflow.

eventsRequired

The event(s) to trigger the workflow.


removeJob
public removeJob(id: string): void

Removes a single job to the workflow.

idRequired
  • Type: string

The job name (unique within the workflow).


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 worklow 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.
name
stringThe name of the workflow.
projenCredentials
GithubCredentials
GitHub API authentication method used by projen workflows.
concurrency
ConcurrencyOptions
The concurrency configuration of 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

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.


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.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

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.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
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.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

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.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

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.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

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.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Writes the file to the project's output directory.
addLine
Adds a line to the text file.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Writes the file to the project's output directory.

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.
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.


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.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

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.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.
addJob
Adds a single job to the workflow.
addJobs
Add jobs to the workflow.
getJob
Get a single job from the workflow.
on
Add events to triggers the workflow.
removeJob
Removes a single job to the workflow.
updateJob
Updates a single job to the workflow.
updateJobs
Updates jobs for this worklow Does a complete replace, it does not try to merge the jobs.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

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.


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

Get a single job from the workflow.

idRequired
  • Type: string

The job name (unique within the workflow).


on
public on(events: Triggers): void

Add events to triggers the workflow.

eventsRequired

The event(s) to trigger the workflow.


removeJob
public removeJob(id: string): void

Removes a single job to the workflow.

idRequired
  • Type: string

The job name (unique within the workflow).


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 worklow 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.
name
stringThe name of the workflow.
projenCredentials
GithubCredentials
GitHub API authentication method used by projen workflows.
concurrency
ConcurrencyOptions
The concurrency configuration of 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

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.


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.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

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
anyNo 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: any;
  • Type: any

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
allowedUsernames
string[]Only pull requests authored by these Github usernames will be auto-approved.
label
stringOnly pull requests with this label will be auto-approved.
runsOn
string[]Github Runner selection labels.
runsOnGroup
projen.GroupRunnerOptionsGithub Runner Group selection options.
secret
stringA GitHub secret name which contains a GitHub Access Token with write permissions for the pull_request scope.

allowedUsernamesOptional
public readonly allowedUsernames: string[];
  • Type: string[]
  • Default: ['github-bot']

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


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

Only pull requests with this label 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.


secretOptional
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.

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
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.
runsOn
string[]Github Runner selection labels.

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/


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

Github Runner selection labels.


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.
workingDirectory
stringSpecifies a working directory for a step.
continueOnError
booleanPrevents a job from failing when a step fails.
timeoutMinutes
numberThe maximum number of minutes to run the step before killing the process.
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.


workingDirectoryOptional
public readonly workingDirectory: string;
  • Type: string

Specifies a working directory for a step.

Overrides a job's working directory.


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.


timeoutMinutesOptional
public readonly timeoutMinutes: number;
  • Type: number

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


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.
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.


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.
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.


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 concurrenty, 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.
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.
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.


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.


gitIdentityOptional
public readonly gitIdentity: GitIdentity;
  • Type: GitIdentity
  • Default: the 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.


DependabotGroup

Defines a single group for dependency updates.

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.
excludePatterns
string[]Optionally you can use this to exclude certain dependencies from the group.

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.


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

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


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.
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.


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.


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.
workingDirectory
stringSpecifies a working directory for a step.
continueOnError
booleanPrevents a job from failing when a step fails.
timeoutMinutes
numberThe maximum number of minutes to run the step before killing the process.
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.


workingDirectoryOptional
public readonly workingDirectory: string;
  • Type: string

Specifies a working directory for a step.

Overrides a job's working directory.


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.


timeoutMinutesOptional
public readonly timeoutMinutes: number;
  • Type: number

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


withRequired
public readonly with: DownloadArtifactWith;

Options for download-artifact.


DownloadArtifactWith

Initializer

import { github } from 'projen'

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

Properties

NameTypeDescription
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.

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
stringNo description.
permissions
AppPermissions
The permissions granted to the token.
privateKeySecret
stringNo description.

appIdSecretOptional
public readonly appIdSecret: string;
  • Type: string

permissionsOptional
public readonly permissions: AppPermissions;

The permissions granted to the token.


privateKeySecretOptional
public readonly privateKeySecret: string;
  • Type: string

GithubCredentialsPersonalAccessTokenOptions

Options for GithubCredentials.fromPersonalAccessToken.

Initializer

import { github } from 'projen'

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

Properties

NameTypeDescription
secret
stringNo description.

secretOptional
public readonly secret: string;
  • Type: string

GitHubOptions

Initializer

import { github } from 'projen'

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

Properties

NameTypeDescription
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.
projenTokenSecret
stringThe name of a secret which includes a GitHub Personal Access Token to be used by 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.
workflows
booleanEnables GitHub workflows.

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: true

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.


projenTokenSecretOptional
  • Deprecated: - use projenCredentials
public readonly projenTokenSecret: string;
  • Type: string
  • Default: "PROJEN_GITHUB_TOKEN"

The name of a secret which includes a GitHub Personal Access Token to be used by projen workflows.

This token needs to have the repo, workflows and packages scope.


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.


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.
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.
mergify
booleanWhether mergify should be enabled on this repository or not.
mergifyOptions
MergifyOptions
Options for mergify.
projectType
projen.ProjectTypeWhich type of project this is (library/app).
projenCredentials
GithubCredentials
Choose a method of providing GitHub API access for projen workflows.
projenTokenSecret
stringThe name of a secret which includes a GitHub Personal Access Token to be used by 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.


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

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

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.


mergifyOptional
  • Deprecated: use githubOptions.mergify instead
public readonly mergify: boolean;
  • Type: boolean
  • Default: true

Whether mergify should be enabled on this repository or not.


mergifyOptionsOptional
  • Deprecated: use githubOptions.mergifyOptions instead
public readonly mergifyOptions: MergifyOptions;

Options for mergify.


projectTypeOptional
  • Deprecated: no longer supported at the base project level
public readonly projectType: ProjectType;
  • Type: projen.ProjectType
  • Default: ProjectType.UNKNOWN

Which type of project this is (library/app).


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.


projenTokenSecretOptional
  • Deprecated: use projenCredentials
public readonly projenTokenSecret: string;
  • Type: string
  • Default: "PROJEN_GITHUB_TOKEN"

The name of a secret which includes a GitHub Personal Access Token to be used by projen workflows.

This token needs to have the repo, workflows and packages scope.


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.
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


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.


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

Initializer

import { github } from 'projen'

const mergifyOptions: github.MergifyOptions = { ... }

Properties

NameTypeDescription
queues
MergifyQueue[]
No description.
rules
MergifyRule[]
No description.

queuesOptional
public readonly queues: MergifyQueue[];

rulesOptional
public readonly rules: MergifyRule[];

MergifyQueue

Initializer

import { github } from 'projen'

const mergifyQueue: github.MergifyQueue = { ... }

Properties

NameTypeDescription
commitMessageTemplate
stringTemplate to use as the commit message when using the merge or squash merge method.
conditions
string | MergifyConditionalOperator[]
A list of Conditions string that must match against the pull request for the pull request to be added to the queue.
name
stringThe name of the queue.
mergeMethod
stringMerge method to use.
updateMethod
stringMethod to use to update the pull request with its base branch when the speculative check is done in-place.

commitMessageTemplateRequired
public readonly commitMessageTemplate: string;
  • Type: string

Template to use as the commit message when using the merge or squash merge method.


conditionsRequired
public readonly conditions: string | MergifyConditionalOperator[];

A list of Conditions string that must match against the pull request for the pull request to be added to the queue.

https://docs.mergify.com/conditions/#conditions


nameRequired
public readonly name: string;
  • Type: string

The name of the queue.


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.


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
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.

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.
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.
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.


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.


gitIdentityOptional
public readonly gitIdentity: GitIdentity;
  • Type: GitIdentity
  • Default: the 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
contributorStatement
stringRequire a contributor statement to be included in the PR description.
contributorStatementOptions
ContributorStatementOptions
Options for requiring a contributor statement on Pull Requests.
runsOn
string[]Github Runner selection labels.
runsOnGroup
projen.GroupRunnerOptionsGithub Runner Group selection options.
semanticTitle
booleanValidate that pull request titles follow Conventional Commits.
semanticTitleOptions
SemanticTitleOptions
Options for validating the conventional commit title linter.

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.


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.


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.
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.


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.


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.
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)


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.
workingDirectory
stringSpecifies a working directory for a step.
continueOnError
booleanPrevents a job from failing when a step fails.
timeoutMinutes
numberThe maximum number of minutes to run the step before killing the process.
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.


workingDirectoryOptional
public readonly workingDirectory: string;
  • Type: string

Specifies a working directory for a step.

Overrides a job's working directory.


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.


timeoutMinutesOptional
public readonly timeoutMinutes: number;
  • Type: number

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


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
issues
StaleBehavior
How to handle stale issues.
pullRequest
StaleBehavior
How to handle stale pull requests.
runsOn
string[]Github Runner selection labels.
runsOnGroup
projen.GroupRunnerOptionsGithub 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.


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.


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.
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.
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.


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.


gitIdentityOptional
public readonly gitIdentity: GitIdentity;

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.
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.
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.


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.


gitIdentityOptional
public readonly gitIdentity: GitIdentity;

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.
workingDirectory
stringSpecifies a working directory for a step.
continueOnError
booleanPrevents a job from failing when a step fails.
timeoutMinutes
numberThe maximum number of minutes to run the step before killing the process.
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.


workingDirectoryOptional
public readonly workingDirectory: string;
  • Type: string

Specifies a working directory for a step.

Overrides a job's working directory.


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.


timeoutMinutesOptional
public readonly timeoutMinutes: number;
  • Type: number

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


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

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@v4", "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.

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 }}".


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.
setupGitIdentity
Configures the git identity (user name and email).
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.


setupGitIdentity
import { github } from 'projen'

github.WorkflowActions.setupGitIdentity(id: GitIdentity)

Configures the git identity (user name and email).

idRequired

The identity to use.


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

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.