forked from projen/projen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(node): mutable pull request builds (projen#624)
Introduce "mutablke builds". When enabled (by default) it will cause PR builds to automatically push any changes to synthesized files or snapshots to the PR branch. This only works for branches and will fail for forks (similar behavior to the anti-tamper check). See attached documentation. This means that if a PR is submitted and requires updates to generated files, the PR branch will automatically get updated. It also implies that anti-tamper check is disabled for PR builds. This is done as part of the PR build which means that if the build passes and changes are pushed successfully, the PR check will be successful (doing that as a result of a different workflow will not trigger the PR build). Related to projen#602 and projen#604
- Loading branch information
Elad Ben-Israel
authored
Mar 17, 2021
1 parent
7997b69
commit 757f8b1
Showing
12 changed files
with
321 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Mutable Builds | ||
|
||
Projen synthesizes files that are part of your source repository. This means | ||
that when you change you projenrc file, and execute `projen`, other files in | ||
your repo may change as a result. | ||
|
||
This is also relevant in other situations where your build process _mutates_ | ||
your repository. For example, if you use **snapshot testing**, your repository | ||
includes snapshots which represent expected test results. When your code | ||
changes, you will likely need to update those snapshots as well. | ||
|
||
To ensure that a pull request branch always represent the final state of the | ||
repository, you can enable the `mutableBuild` option in your project | ||
configuration (currently only supported for projects derived from | ||
`NodeProject`). | ||
|
||
When enabled, the PR build workflow (also called `build`) will push any modified | ||
files to the PR branch after a successful build, so that the branch will always | ||
reflect the most up-to-date version of all generated files. | ||
|
||
## Forks | ||
|
||
This feature does not work for forks since it is impossible to safely push | ||
changes to a fork from a PR build. If a PR is created from a fork of the | ||
repository and there are build mutations, the PR build will fail (indicating | ||
that it cannot push to the fork). To fix this, the branch needs to be updated | ||
(same behavior as if mutable builds was disabled). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.