github Submodule
Constructs
AutoApprove
Auto approve pull requests that meet a criteria.
Initializers
import { github } from 'projen'
new github.AutoApprove(github: GitHub, options?: AutoApproveOptions)
| Name | Type | Description |
|---|---|---|
| | No description. |
| | No description. |
githubRequired
- Type: GitHub
optionsOptional
- Type: AutoApproveOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| string | No description. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
labelRequired
public readonly label: string;
- Type: string
AutoMerge
Automatically merge Pull Requests using Mergify.
[!NOTE] GitHub now natively provides the same features, so you don't need Mergify anymore. See
GitHubOptions.mergeQueueandMergeQueueOptions.autoQueue.
If buildJob is specified, the specified GitHub workflow job ID is required
to succeed in order for the PR to be merged.
approvedReviews specified the number of code review approvals required for
the PR to be merged.
Initializers
import { github } from 'projen'
new github.AutoMerge(github: GitHub, options?: AutoMergeOptions)
| Name | Type | Description |
|---|---|---|
| | No description. |
| | No description. |
githubRequired
- Type: GitHub
optionsOptional
- Type: AutoMergeOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds conditions to the auto merge rule. |
| 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
- Type: IAddConditionsLater
The later.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No 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)
| Name | Type | Description |
|---|---|---|
| constructs.IConstruct | No description. |
| | No description. |
scopeRequired
- Type: constructs.IConstruct
optionsOptional
- Type: AutoQueueOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No 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)
| Name | Type | Description |
|---|---|---|
| | No description. |
| | No description. |
githubRequired
- Type: GitHub
optionsOptional
- Type: DependabotOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Allows a dependency from automatic updates. |
| 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| any | The raw dependabot configuration. |
| boolean | Whether 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.
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)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsOptional
- Type: GitHubOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| No description. |
| No description. |
| Adds a workflow to the project. |
| 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
- Type: DependabotOptions
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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| | The GitHub Actions provider used to manage the versions of actions used in steps. |
| boolean | Whether downloading from LFS is enabled for this GitHub project. |
| | GitHub API authentication method used by projen workflows. |
| | All workflows. |
| boolean | Are workflows enabled? |
| | The MergeQueue component configured on this repository This is undefined if merge queues are not enabled for this repository. |
| | 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;
- Type: 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;
- Type: GithubCredentials
GitHub API authentication method used by projen workflows.
workflowsRequired
public readonly workflows: GithubWorkflow[];
- Type: GithubWorkflow[]
All workflows.
workflowsEnabledRequired
public readonly workflowsEnabled: boolean;
- Type: boolean
Are workflows enabled?
mergeQueueOptional
public readonly mergeQueue: MergeQueue;
- Type: 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;
- Type: 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)
| Name | Type | Description |
|---|---|---|
| | No description. |
optionsRequired
- Type: GitHubProjectOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Exclude the matching files from pre-synth cleanup. |
| Adds a .gitignore pattern. |
| Exclude these files from the bundled package. |
| Adds a new task to this project. |
| Prints a "tip" message during synthesis. |
| Marks the provided file(s) as being generated. |
| Called after all components are synthesized. |
| Called before all components are synthesized. |
| Removes a task from a project. |
| Returns the shell command to execute in order to run a task. |
| Synthesize all project files into outdir. |
| Finds a file at the specified relative path within this project and all its subprojects. |
| Finds a json file by name. |
| Finds an object file (like JsonFile, YamlFile, etc.) by name. |
| Finds a file at the specified relative path within this project and removes it. |
toString
toStringpublic toString(): string
Returns a string representation of this construct.
addExcludeFromCleanup
addExcludeFromCleanuppublic 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
addGitIgnorepublic addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
patternRequired
- Type: string
The glob pattern to ignore.
addPackageIgnore
addPackageIgnorepublic 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
addTaskpublic 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
addTippublic addTip(message: string): void
Prints a "tip" message during synthesis.
messageRequired
- Type: string
The message.
annotateGenerated
annotateGeneratedpublic 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
postSynthesizepublic postSynthesize(): void
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
preSynthesizepublic preSynthesize(): void
Called before all components are synthesized.
removeTask
removeTaskpublic removeTask(name: string): Task
Removes a task from a project.
nameRequired
- Type: string
The name of the task to remove.
runTaskCommand
runTaskCommandpublic 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
synthpublic synth(): void
Synthesize all project files into outdir.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- Call "this.postSynthesize()"
tryFindFile
tryFindFilepublic 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
tryFindJsonFilepublic tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
filePathRequired
- Type: string
The file path.
tryFindObjectFile
tryFindObjectFilepublic tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePathRequired
- Type: string
The file path.
tryRemoveFile
tryRemoveFilepublic 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a project. |
| Find the closest ancestor project for given construct. |
isConstruct
isConstructimport { 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
isProjectimport { github } from 'projen'
github.GitHubProject.isProject(x: any)
Test whether the given construct is a project.
xRequired
- Type: any
of
ofimport { 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Task | No description. |
| boolean | Whether to commit the managed files by default. |
| projen.Task | No description. |
| projen.Component[] | Returns all the components within this project. |
| projen.Dependencies | Project dependencies. |
| boolean | Whether or not the project is being ejected. |
| projen.FileBase[] | All files in this project. |
| projen.GitAttributesFile | The .gitattributes file for this repository. |
| projen.IgnoreFile | .gitignore. |
| projen.Logger | Logging utilities. |
| string | Project name. |
| string | Absolute output directory of this project. |
| projen.Task | No description. |
| projen.Task | No description. |
| projen.Task | No description. |
| projen.ProjectBuild | Manages the build process of the project. |
| string | The command to use in order to run the projen CLI. |
| projen.Project | The root project. |
| projen.Project[] | Returns all the subprojects within this project. |
| projen.Tasks | Project tasks. |
| projen.Task | No description. |
| projen.Task | This is the "default" task, the one that executes "projen". |
| projen.InitProject | The options used when this project is bootstrapped via projen new. |
| projen.Project | A parent project. |
| projen.ProjectType | No description. |
| | Auto approve set up for this project. |
| projen.vscode.DevContainer | Access for .devcontainer.json (used for GitHub Codespaces). |
| | Access all github components. |
| projen.Gitpod | Access for Gitpod. |
| projen.vscode.VsCode | Access all VSCode components. |
nodeRequired
node- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
buildTask- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
commitGenerated- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
compileTask- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
components- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
deps- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
ejected- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
files- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
gitattributes- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
gitignore- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
logger- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
name- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
outdir- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
packageTask- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
postCompileTask- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
preCompileTask- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
projectBuild- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
projenCommand- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
root- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
subprojects- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
tasks- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
testTask- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
defaultTask- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
initProject- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
parent- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
projectType- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
autoApprove- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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;
- Type: AutoApprove
Auto approve set up for this project.
devContainerOptional
devContainer- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
github- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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;
- Type: GitHub
Access all github components.
This will be undefined for subprojects.
gitpodOptional
gitpod- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
vscode- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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
| Name | Type | Description |
|---|---|---|
| string | The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASKRequired
DEFAULT_TASK- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProjectandJavaProjectare 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)
| Name | Type | Description |
|---|---|---|
| | The GitHub component of the project this workflow belongs to. |
| string | The name of the workflow, displayed under the repository's "Actions" tab. |
| | Additional options to configure the workflow. |
githubRequired
- Type: GitHub
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
- Type: GithubWorkflowOptions
Additional options to configure the workflow.
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds a single job to the workflow. |
| Add jobs to the workflow. |
| Get a single job from the workflow. |
| Add events to triggers the workflow. |
| Removes a single job to the workflow. |
| Updates a single job to the workflow. |
| Updates jobs for this workflow Does a complete replace, it does not try to merge the jobs. |
toString
public toString(): string
Returns a string representation of this construct.
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
- Type: JobCallingReusableWorkflow | Job
The job specification.
addJobs
public addJobs(jobs: {[ key: string ]: JobCallingReusableWorkflow | Job}): void
Add jobs to the workflow.
jobsRequired
- Type: {[ key: string ]: JobCallingReusableWorkflow | Job}
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
- Type: Triggers
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
- Type: JobCallingReusableWorkflow | Job
updateJobs
public updateJobs(jobs: {[ key: string ]: JobCallingReusableWorkflow | Job}): void
Updates jobs for this workflow Does a complete replace, it does not try to merge the jobs.
jobsRequired
- Type: {[ key: string ]: JobCallingReusableWorkflow | Job}
Jobs to update.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| | All current jobs of the workflow. |
| string | The name of the workflow. |
| | GitHub API authentication method used by projen workflows. |
| | The concurrency configuration of the workflow. |
| {[ key: string ]: string} | Additional environment variables to set for the workflow. |
| projen.YamlFile | The workflow YAML file. |
| string | The name for workflow runs generated from the workflow. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
jobsRequired
public readonly jobs: {[ key: string ]: JobCallingReusableWorkflow | Job};
- Type: {[ key: string ]: JobCallingReusableWorkflow | Job}
All current jobs of the workflow.
This is a read-only copy, use the respective helper methods to add, update or remove jobs.
nameRequired
public readonly name: string;
- Type: string
The name of the workflow.
GitHub displays the names of your workflows under your repository's "Actions" tab.
https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#name
projenCredentialsRequired
public readonly projenCredentials: GithubCredentials;
- Type: GithubCredentials
GitHub API authentication method used by projen workflows.
concurrencyOptional
public readonly concurrency: ConcurrencyOptions;
- Type: ConcurrencyOptions
The concurrency configuration of the workflow.
undefined means no concurrency limitations.
envOptional
public readonly env: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Additional environment variables to set for the workflow.
fileOptional
public readonly file: YamlFile;
- Type: projen.YamlFile
The workflow YAML file.
May not exist if workflowsEnabled is false on GitHub.
runNameOptional
public readonly runName: string;
- Type: string
The name for workflow runs generated from the workflow.
GitHub displays the
workflow run name in the list of workflow runs on your repository's
"Actions" tab. If run-name is omitted or is only whitespace, then the run
name is set to event-specific information for the workflow run. For
example, for a workflow triggered by a push or pull_request event, it
is set as the commit message.
This value can include expressions and can reference github and inputs
contexts.
MergeQueue
Merge pull requests using a merge queue.
Initializers
import { github } from 'projen'
new github.MergeQueue(scope: IConstruct, options?: MergeQueueOptions)
| Name | Type | Description |
|---|---|---|
| constructs.IConstruct | No description. |
| | No description. |
scopeRequired
- Type: constructs.IConstruct
optionsOptional
- Type: MergeQueueOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No 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)
| Name | Type | Description |
|---|---|---|
| | No description. |
| | No description. |
githubRequired
- Type: GitHub
optionsOptional
- Type: MergifyOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| No description. |
| 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
- Type: MergifyQueue
addRule
public addRule(rule: MergifyRule): void
ruleRequired
- Type: MergifyRule
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No 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)
| Name | Type | Description |
|---|---|---|
| constructs.IConstruct | No description. |
| | No description. |
scopeRequired
- Type: constructs.IConstruct
optionsOptional
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| projen.JsonFile | No description. |
| | 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;
- Type: 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)
| Name | Type | Description |
|---|---|---|
| | No description. |
| | No description. |
githubRequired
- Type: GitHub
optionsOptional
- Type: PullRequestLintOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No 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)
| Name | Type | Description |
|---|---|---|
| | No description. |
| | No description. |
githubRequired
- Type: GitHub
optionsOptional
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Writes the file to the project's output directory. |
| 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| string | The absolute path of this file. |
| string | The file path, relative to the project's outdir. |
| boolean | Indicates if the file has been changed during synthesis. |
| string | The projen marker, used to identify files as projen-generated. |
| boolean | Indicates if the file should be marked as executable. |
| boolean | Indicates 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.
Initializers
import { github } from 'projen'
new github.Stale(github: GitHub, options?: StaleOptions)
| Name | Type | Description |
|---|---|---|
| | No description. |
| | No description. |
githubRequired
- Type: GitHub
optionsOptional
- Type: StaleOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No 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)
| Name | Type | Description |
|---|---|---|
| | No description. |
| | No description. |
githubRequired
- Type: GitHub
optionsRequired
- Type: TaskWorkflowOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds a single job to the workflow. |
| Add jobs to the workflow. |
| Get a single job from the workflow. |
| Add events to triggers the workflow. |
| Removes a single job to the workflow. |
| Updates a single job to the workflow. |
| Updates jobs for this workflow Does a complete replace, it does not try to merge the jobs. |
toString
public toString(): string
Returns a string representation of this construct.
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
- Type: JobCallingReusableWorkflow | Job
The job specification.
addJobs
public addJobs(jobs: {[ key: string ]: JobCallingReusableWorkflow | Job}): void
Add jobs to the workflow.
jobsRequired
- Type: {[ key: string ]: JobCallingReusableWorkflow | Job}
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
- Type: Triggers
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
- Type: JobCallingReusableWorkflow | Job
updateJobs
public updateJobs(jobs: {[ key: string ]: JobCallingReusableWorkflow | Job}): void
Updates jobs for this workflow Does a complete replace, it does not try to merge the jobs.
jobsRequired
- Type: {[ key: string ]: JobCallingReusableWorkflow | Job}
Jobs to update.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| | All current jobs of the workflow. |
| string | The name of the workflow. |
| | GitHub API authentication method used by projen workflows. |
| | The concurrency configuration of the workflow. |
| {[ key: string ]: string} | Additional environment variables to set for the workflow. |
| projen.YamlFile | The workflow YAML file. |
| string | The name for workflow runs generated from the workflow. |
| string | No description. |
| string | No description. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
jobsRequired
public readonly jobs: {[ key: string ]: JobCallingReusableWorkflow | Job};
- Type: {[ key: string ]: JobCallingReusableWorkflow | Job}
All current jobs of the workflow.
This is a read-only copy, use the respective helper methods to add, update or remove jobs.
nameRequired
public readonly name: string;
- Type: string
The name of the workflow.
GitHub displays the names of your workflows under your repository's "Actions" tab.
https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#name
projenCredentialsRequired
public readonly projenCredentials: GithubCredentials;
- Type: GithubCredentials
GitHub API authentication method used by projen workflows.
concurrencyOptional
public readonly concurrency: ConcurrencyOptions;
- Type: ConcurrencyOptions
The concurrency configuration of the workflow.
undefined means no concurrency limitations.
envOptional
public readonly env: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Additional environment variables to set for the workflow.
fileOptional
public readonly file: YamlFile;
- Type: projen.YamlFile
The workflow YAML file.
May not exist if workflowsEnabled is false on GitHub.
runNameOptional
public readonly runName: string;
- Type: string
The name for workflow runs generated from the workflow.
GitHub displays the
workflow run name in the list of workflow runs on your repository's
"Actions" tab. If run-name is omitted or is only whitespace, then the run
name is set to event-specific information for the workflow run. For
example, for a workflow triggered by a push or pull_request event, it
is set as the commit message.
This value can include expressions and can reference github and inputs
contexts.
jobIdRequired
public readonly jobId: string;
- Type: string
artifactsDirectoryOptional
public readonly artifactsDirectory: string;
- Type: string
TaskWorkflowJob
The primary or initial job of a TaskWorkflow.
Initializers
import { github } from 'projen'
new github.TaskWorkflowJob(scope: IConstruct, task: Task, options: TaskWorkflowJobOptions)
| Name | Type | Description |
|---|---|---|
| constructs.IConstruct | should be part of the project the Task belongs to. |
| projen.Task | the main task that is run as part of this job. |
| | 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
- Type: TaskWorkflowJobOptions
options to configure the TaskWorkflowJob.
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| | No description. |
| | No description. |
| any | No description. |
| | No description. |
| boolean | No description. |
| | No description. |
| {[ key: string ]: string} | No description. |
| string | No description. |
| string | No description. |
| string | No description. |
| string[] | No description. |
| | No description. |
| string[] | No description. |
| projen.GroupRunnerOptions | No description. |
| | No description. |
| | No description. |
| number | No description. |
| | 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;
- Type: JobPermissions
stepsRequired
public readonly steps: JobStep[];
- Type: JobStep[]
concurrencyOptional
public readonly concurrency: any;
- Type: any
containerOptional
public readonly container: ContainerOptions;
- Type: ContainerOptions
continueOnErrorOptional
public readonly continueOnError: boolean;
- Type: boolean
defaultsOptional
public readonly defaults: JobDefaults;
- Type: JobDefaults
envOptional
public readonly env: {[ key: string ]: string};
- Type: {[ key: string ]: string}
environmentOptional
public readonly environment: string;
- Type: string
ifOptional
public readonly if: string;
- Type: string
nameOptional
public readonly name: string;
- Type: string
needsOptional
public readonly needs: string[];
- Type: string[]
outputsOptional
public readonly outputs: {[ key: string ]: JobStepOutput};
- Type: {[ 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};
- Type: {[ key: string ]: ContainerOptions}
strategyOptional
public readonly strategy: JobStrategy;
- Type: JobStrategy
timeoutMinutesOptional
public readonly timeoutMinutes: number;
- Type: number
toolsOptional
public readonly tools: Tools;
- Type: Tools
Structs
AutoApproveOptions
Options for 'AutoApprove'.
Initializer
import { github } from 'projen'
const autoApproveOptions: github.AutoApproveOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | Only pull requests authored by these Github usernames will be auto-approved. |
| string | Only pull requests with this label will be auto-approved. |
| string[] | Github Runner selection labels. |
| projen.GroupRunnerOptions | Github Runner Group selection options. |
| string | A 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
depsUpgradeproperty inNodeProjectOptions, then you must use a different token here.
AutoMergeOptions
Initializer
import { github } from 'projen'
const autoMergeOptions: github.AutoMergeOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| number | Number of approved code reviews. |
| string[] | List of labels that will prevent auto-merging. |
| string | Name of the mergify queue. |
| string | Name 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
| Name | Type | Description |
|---|---|---|
| string[] | Only pull requests authored by these Github usernames will have auto-queue enabled. |
| string[] | Only pull requests with one of this labels will have auto-queue enabled. |
| | The method used to add the PR to the merge queue Any branch protection rules must allow this merge method. |
| | Choose a method for authenticating with GitHub to enable auto-queue on pull requests. |
| string[] | Github Runner selection labels. |
| string[] | The branch names that we should auto-queue for. |
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;
- Type: MergeMethod
- Default: MergeMethod.SQUASH
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;
- Type: GithubCredentials
- Default: uses credentials from the GitHub component
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.
runsOnOptional
public readonly runsOn: string[];
- Type: string[]
- Default: ["ubuntu-latest"]
Github Runner selection labels.
targetBranchesOptional
public readonly targetBranches: string[];
- Type: string[]
The branch names that we should auto-queue for.
This set of branches should be a subset of MergeQueueOptions.targetBranches.
Be sure not to enable autoQueue for branches that don't have branch rules
with merge requirements set up, otherwise new PRs will be merged
immediately after creating without a chance for review.
Automatically merging a set of Stacked PRs
If you set this to ['main'] you can automatically merge a set of Stacked PRs
in the right order. It works like this:
- Create PR #1 from branch
a, targetingmain. - Create PR #2 from branch
b, targeting brancha. - Create PR #3 from branch
c, targeting branchb.
Initially, PR #1 will be set to auto-merge, PRs #2 and #3 will not.
Once PR #1 passes all of its requirements it will merge. That will delete
branch a and change the target branch of PR #2 change to main. At that
point, auto-queueing will switch on for PR #2 and it gets merged, etc.
[!IMPORTANT] This component will never disable AutoMerge, only enable it. So if a PR is initially targeted at one of the branches in this list, and then subsequently retargeted to another branch, AutoMerge is not automatically turned off.
CheckoutOptions
Initializer
import { github } from 'projen'
const checkoutOptions: github.CheckoutOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| {[ key: string ]: string} | Sets environment variables for steps to use in the runner environment. |
| string | A unique identifier for the step. |
| string | You can use the if conditional to prevent a job from running unless a condition is met. |
| string | A name for your step to display on GitHub. |
| string | Overrides the default shell settings in the runner's operating system and the job's default. |
| string | Specifies a working directory for a step. |
| boolean | Prevents a job from failing when a step fails. |
| number | The maximum number of minutes to run the step before killing the process. |
| | Options for checkout. |
envOptional
public readonly env: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Sets environment variables for steps to use in the runner environment.
You can also set environment variables for the entire workflow or a job.
idOptional
public readonly id: string;
- Type: string
A unique identifier for the step.
You can use the id to reference the step in contexts.
ifOptional
public readonly if: string;
- Type: string
You can use the if conditional to prevent a job from running unless a condition is met.
You can use any supported context and expression to create a conditional.
nameOptional
public readonly name: string;
- Type: string
A name for your step to display on GitHub.
shellOptional
public readonly shell: string;
- Type: string
Overrides the default shell settings in the runner's operating system and the job's default.
Refer to GitHub documentation for allowed values.
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;
- Type: CheckoutWith
Options for checkout.
CheckoutWith
Options for checkout.
Initializer
import { github } from 'projen'
const checkoutWith: github.CheckoutWith = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| number | Number of commits to fetch. |
| boolean | Whether LFS is enabled for the GitHub repository. |
| string | Relative path under $GITHUB_WORKSPACE to place the repository. |
| string | Branch or tag name. |
| string | The repository (owner/repo) to use. |
| string | A 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
| Name | Type | Description |
|---|---|---|
| number | Number of commits to fetch. |
| boolean | Whether LFS is enabled for the GitHub repository. |
| string | Relative path under $GITHUB_WORKSPACE to place the repository. |
| string | Branch or tag name. |
| string | The repository (owner/repo) to use. |
| string | A GitHub token to use when checking out the repository. |
| string | The 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
| Name | Type | Description |
|---|---|---|
| boolean | When a workflow is triggered while another one (in the same group) is running, should GitHub cancel the running workflow? |
| string | Concurrency 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.
ContributorStatementOptions
Options for requiring a contributor statement on Pull Requests.
Initializer
import { github } from 'projen'
const contributorStatementOptions: github.ContributorStatementOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | Pull requests with one of these labels are exempted from a contributor statement. |
| 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
| Name | Type | Description |
|---|---|---|
| string | Description added to the pull request. |
| string | The full title used to create the pull request. |
| string | The name of the workflow that will create the PR. |
| string[] | Assignees to add on the PR. |
| string | Sets the pull request base branch. |
| string | The pull request branch name. |
| | The job credentials used to create the pull request. |
| | The git identity used to create the commit. |
| string[] | Labels to apply on the PR. |
| boolean | Add Signed-off-by line by the committer at the end of the commit log message. |
| string | The step ID which produces the output which indicates if a patch was created. |
| string | The 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;
- Type: 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: 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
| Name | Type | Description |
|---|---|---|
| string | Use 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
| Name | Type | Description |
|---|---|---|
| string[] | Define a list of strings (with or without wildcards) that will match package names to form this dependency group. |
| | Specify which type of update the group applies to. |
| | Limit the group to a type of dependency. |
| string[] | Optionally you can use this to exclude certain dependencies from the group. |
| | Limit the group to one or more semantic versioning levels. |
patternsRequired
public readonly patterns: string[];
- Type: string[]
Define a list of strings (with or without wildcards) that will match package names to form this dependency group.
appliesToOptional
public readonly appliesTo: DependabotGroupAppliesTo;
- Type: DependabotGroupAppliesTo
- Default: version updates
Specify which type of update the group applies to.
dependencyTypeOptional
public readonly dependencyType: DependabotGroupDependencyType;
- Type: DependabotGroupDependencyType
- Default: all types of dependencies
Limit the group to a type of dependency.
excludePatternsOptional
public readonly excludePatterns: string[];
- Type: string[]
Optionally you can use this to exclude certain dependencies from the group.
updateTypesOptional
public readonly updateTypes: DependabotGroupUpdateType[];
- Type: DependabotGroupUpdateType[]
- Default: all semantic versioning levels
Limit the group to one or more semantic versioning levels.
If specified, must contain at least one element and elements must be unique.
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
| Name | Type | Description |
|---|---|---|
| string | Use to ignore updates for dependencies with matching names, optionally using * to match zero or more characters. |
| 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
| Name | Type | Description |
|---|---|---|
| | https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#allow. |
| string[] | Specify individual assignees or teams of assignees for all pull requests raised for a package manager. |
| | https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#groups. |
| | You can use the ignore option to customize which dependencies are updated. |
| boolean | Ignores updates to projen. |
| string[] | List of labels to apply to the created PR's. |
| number | Sets the maximum of pull requests Dependabot opens for version updates. |
| | Map of package registries to use. |
| string[] | Specify individual reviewers or teams of reviewers for all pull requests raised for a package manager. |
| | How often to check for new versions and raise pull requests. |
| 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. |
| | The strategy to use when edits manifest and lock files. |
allowOptional
public readonly allow: DependabotAllow[];
- Type: DependabotAllow[]
- Default: []
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};
- Type: {[ key: string ]: DependabotGroup}
- Default: []
You can create groups to package dependency updates together into a single PR.
ignoreOptional
public readonly ignore: DependabotIgnore[];
- Type: DependabotIgnore[]
- Default: []
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};
- Type: {[ key: string ]: DependabotRegistry}
- Default: use public registries
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;
- Type: DependabotScheduleInterval
- Default: ScheduleInterval.DAILY
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.
Initializer
import { github } from 'projen'
const dependabotRegistry: github.DependabotRegistry = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| | Registry type e.g. 'npm-registry' or 'docker-registry'. |
| string | Url for the registry e.g. 'https://npm.pkg.github.com' or 'registry.hub.docker.com'. |
| string | A reference to a Dependabot secret containing an access key for this registry. |
| string | Used with the hex-organization registry type. |
| string | A reference to a Dependabot secret containing the password for the specified user. |
| boolean | 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). |
| string | Secret token for dependabot access e.g. '${{ secrets.DEPENDABOT_PACKAGE_TOKEN }}'. |
| string | The username that Dependabot uses to access the registry. |
typeRequired
public readonly type: DependabotRegistryType;
- 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.
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
| Name | Type | Description |
|---|---|---|
| {[ key: string ]: string} | Sets environment variables for steps to use in the runner environment. |
| string | A unique identifier for the step. |
| string | You can use the if conditional to prevent a job from running unless a condition is met. |
| string | A name for your step to display on GitHub. |
| string | Overrides the default shell settings in the runner's operating system and the job's default. |
| string | Specifies a working directory for a step. |
| boolean | Prevents a job from failing when a step fails. |
| number | The maximum number of minutes to run the step before killing the process. |
| | Options for download-artifact. |
envOptional
public readonly env: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Sets environment variables for steps to use in the runner environment.
You can also set environment variables for the entire workflow or a job.
idOptional
public readonly id: string;
- Type: string
A unique identifier for the step.
You can use the id to reference the step in contexts.
ifOptional
public readonly if: string;
- Type: string
You can use the if conditional to prevent a job from running unless a condition is met.
You can use any supported context and expression to create a conditional.
nameOptional
public readonly name: string;
- Type: string
A name for your step to display on GitHub.
shellOptional
public readonly shell: string;
- Type: string
Overrides the default shell settings in the runner's operating system and the job's default.
Refer to GitHub documentation for allowed values.
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;
- Type: DownloadArtifactWith
Options for download-artifact.
DownloadArtifactWith
Initializer
import { github } from 'projen'
const downloadArtifactWith: github.DownloadArtifactWith = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | 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. |
| string | Name of the artifact to download. |
| string | A file, directory or wildcard pattern that describes what to download. |
| string | A glob pattern to the artifacts that should be downloaded This is ignored if name is specified. |
| string | 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. |
| string | 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. |
| string | The 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
| Name | Type | Description |
|---|---|---|
| string | The secret containing the GitHub App ID. |
| string | The owner of the GitHub App installation. |
| | The permissions granted to the token. |
| string | The secret containing the GitHub App private key. |
| string[] | List of repositories to grant access to. |
appIdSecretOptional
public readonly appIdSecret: string;
- Type: string
- Default: "PROJEN_APP_ID"
The secret containing the GitHub App ID.
ownerOptional
public readonly owner: string;
- Type: string
- Default: if empty, defaults to the current repository owner
The owner of the GitHub App installation.
permissionsOptional
public readonly permissions: AppPermissions;
- Type: AppPermissions
- Default: all permissions granted to the app
The permissions granted to the token.
privateKeySecretOptional
public readonly privateKeySecret: string;
- Type: string
- Default: "PROJEN_APP_PRIVATE_KEY"
The secret containing the GitHub App private key.
Escaped newlines (\n) will be automatically replaced with actual newlines.
repositoriesOptional
public readonly repositories: string[];
- Type: string[]
- Default: if owner is set and repositories is empty, access will be scoped to all repositories in the provided repository owner's installation. If owner and repositories are empty, access will be scoped to only the current repository.
List of repositories to grant access to.
GithubCredentialsPersonalAccessTokenOptions
Options for GithubCredentials.fromPersonalAccessToken.
Initializer
import { github } from 'projen'
const githubCredentialsPersonalAccessTokenOptions: github.GithubCredentialsPersonalAccessTokenOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | No description. |
secretOptional
public readonly secret: string;
- Type: string
GitHubOptions
Initializer
import { github } from 'projen'
const gitHubOptions: github.GitHubOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | Download files in LFS in workflows. |
| boolean | Whether a merge queue should be used on this repository to merge pull requests. |
| | Options for MergeQueue. |
| boolean | Whether mergify should be enabled on this repository or not. |
| | Options for Mergify. |
| | Choose a method of providing GitHub API access for projen workflows. |
| string | The name of a secret which includes a GitHub Personal Access Token to be used by projen workflows. |
| boolean | Add a workflow that allows backport of PRs to other branches using labels. |
| | Options for configuring pull request backport. |
| boolean | Add a workflow that performs basic checks for pull requests, like validating that PRs follow Conventional Commits. |
| | Options for configuring a pull request linter. |
| boolean | Enables GitHub workflows. |
downloadLfsOptional
public readonly downloadLfs: boolean;
- Type: boolean
- Default: true if the associated project has
lfsPatterns,falseotherwise
Download files in LFS in workflows.
mergeQueueOptional
public readonly mergeQueue: boolean;
- Type: boolean
- Default: false
Whether a merge queue should be used on this repository to merge pull requests.
Requires additional configuration of the repositories branch protection rules.
mergeQueueOptionsOptional
public readonly mergeQueueOptions: MergeQueueOptions;
- Type: MergeQueueOptions
- Default: default options
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;
- Type: MergifyOptions
- Default: default options
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
projenTokenSecret- 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;
- Type: PullRequestBackportOptions
- Default: see defaults in
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;
- Type: PullRequestLintOptions
- Default: see defaults in
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
| Name | Type | Description |
|---|---|---|
| string | This is the name of your project. |
| boolean | Whether to commit the managed files by default. |
| projen.IgnoreFileOptions | Configuration options for .gitignore file. |
| projen.GitOptions | Configuration options for git. |
| projen.LoggerOptions | Configure logging options such as verbosity. |
| string | The root directory of the project. |
| projen.Project | The parent project, if this project is part of a bigger project. |
| string | The shell command to use in order to run the projen CLI. |
| boolean | Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation. |
| projen.ProjenrcJsonOptions | Options for .projenrc.json. |
| boolean | Use renovatebot to handle dependency upgrades. |
| projen.RenovatebotOptions | Options for renovatebot. |
| | Enable and configure the 'auto approve' workflow. |
| boolean | Enable automatic merging on GitHub. |
| | Configure options for automatic merging on GitHub. |
| boolean | Add a clobber task which resets the repo to origin. |
| boolean | Add a VSCode development environment (used for GitHub Codespaces). |
| boolean | Enable GitHub integration. |
| | Options for GitHub integration. |
| boolean | Add a Gitpod development environment. |
| boolean | Whether mergify should be enabled on this repository or not. |
| | Options for mergify. |
| projen.ProjectType | Which type of project this is (library/app). |
| | Choose a method of providing GitHub API access for projen workflows. |
| string | The name of a secret which includes a GitHub Personal Access Token to be used by projen workflows. |
| projen.SampleReadmeProps | The README setup. |
| boolean | Auto-close of stale issues and pull request. |
| | Auto-close stale issues and pull requests. |
| boolean | Enable 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;
- Type: AutoApproveOptions
- Default: auto approve is disabled
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;
- Type: AutoMergeOptions
- Default: see defaults in
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;
- Type: GitHubOptions
- Default: see GitHubOptions
Options for GitHub integration.
gitpodOptional
public readonly gitpod: boolean;
- Type: boolean
- Default: false
Add a Gitpod development environment.
mergifyOptional
mergify- Deprecated: use
githubOptions.mergifyinstead
public readonly mergify: boolean;
- Type: boolean
- Default: true
Whether mergify should be enabled on this repository or not.
mergifyOptionsOptional
mergifyOptions- Deprecated: use
githubOptions.mergifyOptionsinstead
public readonly mergifyOptions: MergifyOptions;
- Type: MergifyOptions
- Default: default options
Options for mergify.
projectTypeOptional
projectType- 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
projenTokenSecret- 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;
- Type: StaleOptions
- Default: see defaults in
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
| Name | Type | Description |
|---|---|---|
| | Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. |
| {[ key: string ]: string} | Additional environment variables to set for the workflow. |
| string | Set a custom file name for the workflow definition file. Must include either a .yml or .yaml file extension. |
| boolean | Force the creation of the workflow even if workflows is disabled in GitHub. |
| boolean | Enable 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.
envOptional
public readonly env: {[ key: string ]: string};
- Type: {[ key: string ]: string}
- Default: no additional environment variables
Additional environment variables to set for the workflow.
fileNameOptional
public readonly fileName: string;
- Type: string
- Default: a path-safe version of the workflow name plus the .yml file ending, e.g. build.yml
Set a custom file name for the workflow definition file. Must include either a .yml or .yaml file extension.
Use this option to set a file name for the workflow file, that is different than the display name.
Example
"my-workflow.yaml"
forceOptional
public readonly force: boolean;
- Type: boolean
- Default: false
Force the creation of the workflow even if workflows is disabled in GitHub.
limitConcurrencyOptional
public readonly limitConcurrency: boolean;
- Type: boolean
- Default: false
Enable concurrency limitations.
Use concurrencyOptions to configure specific non default values.
GitIdentity
Represents the git identity.
Initializer
import { github } from 'projen'
const gitIdentity: github.GitIdentity = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | The email address of the git user. |
| string | The 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
| Name | Type | Description |
|---|---|---|
| boolean | Should pull requests be queued automatically to be merged once they pass required checks. |
| | Configure auto-queue pull requests. |
| 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;
- Type: AutoQueueOptions
- Default: see 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
| Name | Type | Description |
|---|---|---|
| | No description. |
| | No description. |
andOptional
public readonly and: (string | MergifyConditionalOperator)[];
- Type: string | MergifyConditionalOperator[]
orOptional
public readonly or: (string | MergifyConditionalOperator)[];
- Type: string | MergifyConditionalOperator[]
MergifyOptions
Configure Mergify.
This currently only offers a subset of options available.
Initializer
import { github } from 'projen'
const mergifyOptions: github.MergifyOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| | The available merge queues. |
| | Pull request automation rules. |
queuesOptional
public readonly queues: MergifyQueue[];
- Type: MergifyQueue[]
The available merge queues.
rulesOptional
public readonly rules: MergifyRule[];
- Type: MergifyRule[]
Pull request automation rules.
MergifyQueue
Initializer
import { github } from 'projen'
const mergifyQueue: github.MergifyQueue = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | Template to use as the commit message when using the merge or squash merge method. |
| string | The name of the queue. |
| | The list of conditions that needs to match to queue the pull request. |
| | The list of conditions to match to get the queued pull request merged. |
| string | Merge method to use. |
| | The list of conditions that needs to match to queue the pull request. |
| string | Method 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.
nameRequired
public readonly name: string;
- Type: string
The name of the queue.
conditionsOptional
conditions- Deprecated: use
queueConditionsinstead
public readonly conditions: (string | MergifyConditionalOperator)[];
- Type: string | MergifyConditionalOperator[]
The list of conditions that needs to match to queue the pull request.
https://docs.mergify.com/configuration/file-format/#queue-rules
mergeConditionsOptional
public readonly mergeConditions: (string | MergifyConditionalOperator)[];
- Type: string | MergifyConditionalOperator[]
The list of conditions to match to get the queued pull request merged.
This automatically includes the queueConditions. In case of speculative merge pull request, the merge conditions are evaluated against the temporary pull request instead of the original one.
mergeMethodOptional
public readonly mergeMethod: string;
- Type: string
- Default: "merge"
Merge method to use.
Possible values are merge, squash, rebase or fast-forward.
fast-forward is not supported on queues with speculative_checks > 1, batch_size > 1, or with allow_inplace_checks set to false.
queueConditionsOptional
public readonly queueConditions: (string | MergifyConditionalOperator)[];
- Type: string | MergifyConditionalOperator[]
The list of conditions that needs to match to queue the pull request.
updateMethodOptional
public readonly updateMethod: string;
- Type: string
- Default:
mergefor all merge methods exceptfast-forwardwhererebaseis used
Method to use to update the pull request with its base branch when the speculative check is done in-place.
Possible values:
mergeto merge the base branch into the pull request.rebaseto rebase the pull request against its base branch.
Note that the rebase method has some drawbacks, see Mergify docs for details.
MergifyRule
Initializer
import { github } from 'projen'
const mergifyRule: github.MergifyRule = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| {[ key: string ]: any} | A dictionary made of Actions that will be executed on the matching pull requests. |
| | A list of Conditions string that must match against the pull request for the rule to be applied. |
| string | The 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.
conditionsRequired
public readonly conditions: (string | MergifyConditionalOperator)[];
- Type: string | MergifyConditionalOperator[]
A list of Conditions string that must match against the pull request for the rule to be applied.
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
| Name | Type | Description |
|---|---|---|
| boolean | Automatically approve backport PRs if the 'auto approve' workflow is available. |
| string | The prefix used to name backport branches. |
| string[] | The labels added to the created backport PR. |
| string[] | List of branches that can be a target for backports. |
| boolean | Should this created Backport PRs with conflicts. |
| string | The prefix used to detect PRs that should be backported. |
| string | The 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
| Name | Type | Description |
|---|---|---|
| string | Description added to the pull request. |
| string | The full title used to create the pull request. |
| string | The name of the workflow that will create the PR. |
| string[] | Assignees to add on the PR. |
| string | Sets the pull request base branch. |
| string | The pull request branch name. |
| | The job credentials used to create the pull request. |
| | The git identity used to create the commit. |
| string[] | Labels to apply on the PR. |
| boolean | Add Signed-off-by line by the committer at the end of the commit log message. |
| string | The step ID which produces the output which indicates if a patch was created. |
| string | The name of the step displayed on GitHub. |
| | Information about the patch that is used to create the pull request. |
| string | The name of the job displayed on GitHub. |
| string[] | Github Runner selection labels. |
| projen.GroupRunnerOptions | Github 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;
- Type: 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: 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;
- Type: 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
| Name | Type | Description |
|---|---|---|
| string | Require a contributor statement to be included in the PR description. |
| | Options for requiring a contributor statement on Pull Requests. |
| string[] | Github Runner selection labels. |
| projen.GroupRunnerOptions | Github Runner Group selection options. |
| boolean | Validate that pull request titles follow Conventional Commits. |
| | 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;
- Type: ContributorStatementOptions
- Default: none
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.
semanticTitleOptionsOptional
public readonly semanticTitleOptions: SemanticTitleOptions;
- Type: SemanticTitleOptions
- Default: title must start with "feat", "fix", or "chore"
Options for validating the conventional commit title linter.
PullRequestPatchSource
Initializer
import { github } from 'projen'
const pullRequestPatchSource: github.PullRequestPatchSource = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| number | Number of commits to fetch. |
| boolean | Whether LFS is enabled for the GitHub repository. |
| string | Relative path under $GITHUB_WORKSPACE to place the repository. |
| string | Branch or tag name. |
| string | The repository (owner/repo) to use. |
| string | A GitHub token to use when checking out the repository. |
| string | The name of the artifact the patch is stored as. |
| string | The id of the job that created the patch file. |
| string | The 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
| Name | Type | Description |
|---|---|---|
| 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.
Initializer
import { github } from 'projen'
const semanticTitleOptions: github.SemanticTitleOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | Configure that a scope must always be provided. |
| string[] | Configure which scopes are allowed (newline-delimited). |
| string[] | Configure a list of commit types that are allowed. |
requireScopeOptional
public readonly requireScope: boolean;
- Type: boolean
- Default: false
Configure that a scope must always be provided.
e.g. feat(ui), fix(core)
scopesOptional
public readonly scopes: string[];
- Type: string[]
- Default: all scopes allowed
Configure which scopes are allowed (newline-delimited).
These are regex patterns auto-wrapped in ^ $.
typesOptional
public readonly types: string[];
- Type: string[]
- Default: ["feat", "fix", "chore"]
Configure a list of commit types that are allowed.
SetupGitIdentityOptions
Initializer
import { github } from 'projen'
const setupGitIdentityOptions: github.SetupGitIdentityOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| {[ key: string ]: string} | Sets environment variables for steps to use in the runner environment. |
| string | A unique identifier for the step. |
| string | You can use the if conditional to prevent a job from running unless a condition is met. |
| string | A name for your step to display on GitHub. |
| string | Overrides the default shell settings in the runner's operating system and the job's default. |
| string | Specifies a working directory for a step. |
| boolean | Prevents a job from failing when a step fails. |
| number | The maximum number of minutes to run the step before killing the process. |
| | The identity to use. |
envOptional
public readonly env: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Sets environment variables for steps to use in the runner environment.
You can also set environment variables for the entire workflow or a job.
idOptional
public readonly id: string;
- Type: string
A unique identifier for the step.
You can use the id to reference the step in contexts.
ifOptional
public readonly if: string;
- Type: string
You can use the if conditional to prevent a job from running unless a condition is met.
You can use any supported context and expression to create a conditional.
nameOptional
public readonly name: string;
- Type: string
A name for your step to display on GitHub.
shellOptional
public readonly shell: string;
- Type: string
Overrides the default shell settings in the runner's operating system and the job's default.
Refer to GitHub documentation for allowed values.
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;
- Type: GitIdentity
The identity to use.
StaleBehavior
Stale behavior.
Initializer
import { github } from 'projen'
const staleBehavior: github.StaleBehavior = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | The comment to add to the issue/PR when it's closed. |
| number | Days until the issue/PR is closed after it is marked as "Stale". |
| number | How many days until the issue or pull request is marked as "Stale". |
| boolean | Determines if this behavior is enabled. |
| string[] | Label which exempt an issue/PR from becoming stale. |
| string | The label to apply to the issue/PR when it becomes stale. |
| string | The 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
| Name | Type | Description |
|---|---|---|
| | How to handle stale issues. |
| | How to handle stale pull requests. |
| string[] | Github Runner selection labels. |
| projen.GroupRunnerOptions | Github Runner Group selection options. |
issuesOptional
public readonly issues: StaleBehavior;
- Type: StaleBehavior
- Default: By default, stale issues with no activity will be marked as stale after 60 days and closed within 7 days.
How to handle stale issues.
pullRequestOptional
public readonly pullRequest: StaleBehavior;
- Type: StaleBehavior
- Default: By default, pull requests with no activity will be marked as stale after 14 days and closed within 2 days with relevant comments.
How to handle stale pull requests.
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
| Name | Type | Description |
|---|---|---|
| | Permissions for the build job. |
| string | 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. |
| | Override for the with property of the source code checkout step. |
| string | Adds an 'if' condition to the workflow. |
| | No description. |
| boolean | Whether to download files from Git LFS for this workflow. |
| {[ key: string ]: string} | Workflow environment variables. |
| string | The GitHub Actions environment used for the job. |
| | The git identity to use in this workflow. |
| | Default settings for all steps in the TaskWorkflow Job. |
| | Mapping of job output names to values/expressions. |
| | Actions to run after the main build step. |
| | Steps to run before the main build step. |
| | Initial steps to run before the source code checkout. |
| string[] | Github Runner selection labels. |
| projen.GroupRunnerOptions | Github Runner Group selection options. |
permissionsRequired
public readonly permissions: JobPermissions;
- Type: 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;
- Type: CheckoutWith
- Default: not set
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;
- Type: ContainerOptions
- Default: default image
downloadLfsOptional
public readonly downloadLfs: boolean;
- Type: boolean
- Default: Use the setting on the corresponding GitHub project
Whether to download files from Git LFS for this workflow.
envOptional
public readonly env: {[ key: string ]: string};
- Type: {[ key: string ]: string}
- Default: {}
Workflow environment variables.
environmentOptional
public readonly environment: string;
- Type: string
- Default: no environment used
The GitHub Actions environment used for the job.
gitIdentityOptional
public readonly gitIdentity: GitIdentity;
- Type: GitIdentity
- Default: default GitHub Actions user
The git identity to use in this workflow.
jobDefaultsOptional
public readonly jobDefaults: JobDefaults;
- Type: JobDefaults
Default settings for all steps in the TaskWorkflow Job.
outputsOptional
public readonly outputs: {[ key: string ]: JobStepOutput};
- Type: {[ key: string ]: JobStepOutput}
- Default: {}
Mapping of job output names to values/expressions.
postBuildStepsOptional
public readonly postBuildSteps: JobStep[];
- Type: JobStep[]
- Default: not set
Actions to run after the main build step.
preBuildStepsOptional
public readonly preBuildSteps: JobStep[];
- Type: JobStep[]
- Default: not set
Steps to run before the main build step.
preCheckoutStepsOptional
public readonly preCheckoutSteps: JobStep[];
- Type: JobStep[]
- Default: not set
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
| Name | Type | Description |
|---|---|---|
| | Permissions for the build job. |
| string | 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. |
| | Override for the with property of the source code checkout step. |
| string | Adds an 'if' condition to the workflow. |
| | No description. |
| boolean | Whether to download files from Git LFS for this workflow. |
| {[ key: string ]: string} | Workflow environment variables. |
| string | The GitHub Actions environment used for the job. |
| | The git identity to use in this workflow. |
| | Default settings for all steps in the TaskWorkflow Job. |
| | Mapping of job output names to values/expressions. |
| | Actions to run after the main build step. |
| | Steps to run before the main build step. |
| | Initial steps to run before the source code checkout. |
| string[] | Github Runner selection labels. |
| projen.GroupRunnerOptions | Github Runner Group selection options. |
| string | The workflow name. |
| projen.Task | The main task to be executed. |
| string | The primary job id. |
| | The triggers for the workflow. |
permissionsRequired
public readonly permissions: JobPermissions;
- Type: 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;
- Type: CheckoutWith
- Default: not set
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;
- Type: ContainerOptions
- Default: default image
downloadLfsOptional
public readonly downloadLfs: boolean;
- Type: boolean
- Default: Use the setting on the corresponding GitHub project
Whether to download files from Git LFS for this workflow.
envOptional
public readonly env: {[ key: string ]: string};
- Type: {[ key: string ]: string}
- Default: {}
Workflow environment variables.
environmentOptional
public readonly environment: string;
- Type: string
- Default: no environment used
The GitHub Actions environment used for the job.
gitIdentityOptional
public readonly gitIdentity: GitIdentity;
- Type: GitIdentity
- Default: default GitHub Actions user
The git identity to use in this workflow.
jobDefaultsOptional
public readonly jobDefaults: JobDefaults;
- Type: JobDefaults
Default settings for all steps in the TaskWorkflow Job.
outputsOptional
public readonly outputs: {[ key: string ]: JobStepOutput};
- Type: {[ key: string ]: JobStepOutput}
- Default: {}
Mapping of job output names to values/expressions.
postBuildStepsOptional
public readonly postBuildSteps: JobStep[];
- Type: JobStep[]
- Default: not set
Actions to run after the main build step.
preBuildStepsOptional
public readonly preBuildSteps: JobStep[];
- Type: JobStep[]
- Default: not set
Steps to run before the main build step.
preCheckoutStepsOptional
public readonly preCheckoutSteps: JobStep[];
- Type: JobStep[]
- Default: not set
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
| Name | Type | Description |
|---|---|---|
| {[ key: string ]: string} | Sets environment variables for steps to use in the runner environment. |
| string | A unique identifier for the step. |
| string | You can use the if conditional to prevent a job from running unless a condition is met. |
| string | A name for your step to display on GitHub. |
| string | Overrides the default shell settings in the runner's operating system and the job's default. |
| string | Specifies a working directory for a step. |
| boolean | Prevents a job from failing when a step fails. |
| number | The maximum number of minutes to run the step before killing the process. |
| | Options for upload-artifact. |
envOptional
public readonly env: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Sets environment variables for steps to use in the runner environment.
You can also set environment variables for the entire workflow or a job.
idOptional
public readonly id: string;
- Type: string
A unique identifier for the step.
You can use the id to reference the step in contexts.
ifOptional
public readonly if: string;
- Type: string
You can use the if conditional to prevent a job from running unless a condition is met.
You can use any supported context and expression to create a conditional.
nameOptional
public readonly name: string;
- Type: string
A name for your step to display on GitHub.
shellOptional
public readonly shell: string;
- Type: string
Overrides the default shell settings in the runner's operating system and the job's default.
Refer to GitHub documentation for allowed values.
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;
- Type: UploadArtifactWith
Options for upload-artifact.
UploadArtifactWith
Initializer
import { github } from 'projen'
const uploadArtifactWith: github.UploadArtifactWith = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | A file, directory or wildcard pattern that describes what to upload. |
| number | The level of compression for Zlib to be applied to the artifact archive. |
| string | The desired behavior if no files are found using the provided path. |
| boolean | Whether to include hidden files in the provided path in the artifact. |
| string | Name of the artifact to upload. |
| boolean | Whether action should overwrite an existing artifact with the same name (should one exist). |
| number | Duration 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
| Name | Type | Description |
|---|---|---|
| string | The name of the output to emit. |
| string | The step ID which produces the output which indicates if a patch was created. |
| string | Fail if a mutation was found and print this error message. |
| string | The name of the artifact the patch is stored as. |
| string | The 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()
| Name | Type | Description |
|---|
Methods
| Name | Description |
|---|---|
| Resolve an action name to the version that should be used, taking into account any overrides. |
| 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
| Name | Description |
|---|---|
| Provide API access through a GitHub App. |
| 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.
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.
optionsOptional
Properties
| Name | Type | Description |
|---|---|---|
| | Setup steps to obtain GitHub credentials. |
| string | The value to use in a workflow when a GitHub token is expected. |
setupStepsRequired
public readonly setupSteps: JobStep[];
- Type: 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()
| Name | Type | Description |
|---|
Static Functions
| Name | Description |
|---|---|
| Checks out a repository and applies a git patch that was created using uploadGitPatch. |
| A step that creates a pull request based on the current repo state. |
| Configures the git identity (user name and email). |
| 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
- Type: CheckoutWithPatchOptions
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
- Type: CreatePullRequestOptions
Options.
setupGitIdentity
setupGitIdentityimport { github } from 'projen'
github.WorkflowActions.setupGitIdentity(id: GitIdentity)
Configures the git identity (user name and email).
idRequired
- Type: GitIdentity
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
- Type: UploadGitPatchOptions
Options.
WorkflowJobs
A set of utility functions for creating jobs in GitHub Workflows.
Initializers
import { github } from 'projen'
new github.WorkflowJobs()
| Name | Type | Description |
|---|
Static Functions
| Name | Description |
|---|---|
| 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()
| Name | Type | Description |
|---|
Static Functions
| Name | Description |
|---|---|
| Checks out a repository. |
| Downloads an artifact. |
| Configures the git identity (user name and email). |
| Checks if a tag exists. |
| Uploads an artifact. |
checkout
import { github } from 'projen'
github.WorkflowSteps.checkout(options?: CheckoutOptions)
Checks out a repository.
optionsOptional
- Type: CheckoutOptions
Options to configure the checkout JobStep.
downloadArtifact
import { github } from 'projen'
github.WorkflowSteps.downloadArtifact(options?: DownloadArtifactOptions)
Downloads an artifact.
optionsOptional
- Type: DownloadArtifactOptions
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
- Type: SetupGitIdentityOptions
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
- Type: JobStepConfiguration
Options to configure the tag-exists JobStep.
uploadArtifact
import { github } from 'projen'
github.WorkflowSteps.uploadArtifact(options: UploadArtifactOptions)
Uploads an artifact.
optionsRequired
- Type: UploadArtifactOptions
Options to configure the upload-artifact JobStep.
Protocols
IAddConditionsLater
- Implemented By: IAddConditionsLater
Methods
| Name | Description |
|---|---|
| No description. |
render
public render(): string[]
Enums
DependabotGroupAppliesTo
The type of update a group applies to.
Members
| Name | Description |
|---|---|
| Apply only to version updates. |
| Apply only to security updates. |
VERSION_UPDATES
Apply only to version updates.
SECURITY_UPDATES
Apply only to security updates.
DependabotGroupDependencyType
The type of dependency a group may be limited to.
Members
| Name | Description |
|---|---|
| Include only dependencies in the "Development dependency group". |
| Include only dependencies in the "Production dependency group". |
DEVELOPMENT
Include only dependencies in the "Development dependency group".
PRODUCTION
Include only dependencies in the "Production dependency group".
DependabotGroupUpdateType
The semantic versioning levels a group may be limited to.
Members
| Name | Description |
|---|---|
| Include major releases. |
| Include minor releases. |
| Include patch releases. |
MAJOR
Include major releases.
MINOR
Include minor releases.
PATCH
Include patch releases.
DependabotRegistryType
Each configuration type requires you to provide particular settings.
Some types allow more than one way to connect
Members
| Name | Description |
|---|---|
| The composer-repository type supports username and password. |
| The docker-registry type supports username and password. |
| The git type supports username and password. |
| The hex-organization type supports organization and key. |
| The maven-repository type supports username and password, or token. |
| The npm-registry type supports username and password, or token. |
| The nuget-feed type supports username and password, or token. |
| The python-index type supports username and password, or token. |
| The rubygems-server type supports username and password, or token. |
| The terraform-registry type supports a token. |
COMPOSER_REGISTRY
The composer-repository type supports username and password.
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
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.
DependabotScheduleInterval
How often to check for new versions and raise pull requests for version updates.
Members
| Name | Description |
|---|---|
| Runs on every weekday, Monday to Friday. |
| Runs once each week. |
| 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
| Name | Description |
|---|---|
| No description. |
| No description. |
| No description. |
SQUASH
MERGE
REBASE
VersioningStrategy
The strategy to use when edits manifest and lock files.
Members
| Name | Description |
|---|---|
| Only create pull requests to update lockfiles updates. |
| - For apps, the version requirements are increased. |
| Relax the version requirement to include both the new and old version, when possible. |
| Always increase the version requirement to match the new version. |
| 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.