Add a flag to allow skipping Github release creation#108
Add a flag to allow skipping Github release creation#108akphi wants to merge 1 commit intochangesets:mainfrom akphi:skip-create-release
Conversation
|
@akphi could you describe your use case that requires introducing this option? |
|
@Andarist My use case is fairly similar to that of babel: I have a monorepo with many workspaces/packages. If I were to publish them, I would accumulate thousands of tags and releases on Github after a short period of time (I saw I could temporarily workaround for now, by setting a post-release script to delete created tags and releases, but it's a hack 😅. |
|
Btw, @Andarist I saw your change in changesets/changesets#701 to add |
|
Would fixed packages and aggregated releases address your needs? Note that I'm planning to introduce those aggregated releases only for linked and fixed packages - at least for now. Introducing that for regular packages is quite problematic when it comes to changeset creation, sorting etc.
I think that releases should not be created with this flag (but I have not tested it). It's because releases are created based on the created tags: Lines 88 to 114 in 37c2edd That being said - the flag that you are asking for is still useful for the use case described in #87. The author of that issue would like to skip creating github releases for their prereleases. Could you rebase this PR on top of the current main branch? In the process please remove the |
src/index.ts
Outdated
|
|
||
| (async () => { | ||
| let githubToken = process.env.GITHUB_TOKEN; | ||
| let skipCreateGithubRelease = Boolean(process.env.SKIP_CREATE_GITHUB_RELEASE); |
There was a problem hiding this comment.
i think that the input option for the action would make more sense and I would call it createGithubReleases. It's default value would be true so you could disable it with false.
There was a problem hiding this comment.
That's a fair point, I also figure this is a bit specific for this use case so polluting function param list with this boolean flag is not great, hence I wrapped it in options. If you think that's overkill, let me know.
src/run.ts
Outdated
| pkg, | ||
| tagName: `${pkg.packageJson.name}@${pkg.packageJson.version}`, | ||
| }, | ||
| skipCreateGithubRelease |
There was a problem hiding this comment.
It imho makes more sense to call createRelease conditionally, rather than to skip releasing within this function.
There was a problem hiding this comment.
The whole content of the createRelease function is about creating the Github release, so I used a guarded if, but perhaps, putting the whole thing in an if block is a bit more future proof 😅
|
|
What about documentation, I would like to mention this somewhere if possible, but I don't know where you would want me to put it. |
|
Due to the change in base branch |
Just a tip - the target branch can usually be changed after clicking Edit. You can change the PR's title there but also the target branch. |
Fixes #87
Added a flag called
SKIP_CREATE_GITHUB_RELEASEto allow skipping publishing release to Github@Andarist If you have other suggestions on the config name or the way I pass down the
booleanplease let me know I can fix it ASAP. Would be really appreciative if you could spare some time to look at this. Thank you so much!Also, I thought about adding some documentation for this on the
README.mdfile, but not sure how to organize that, do you have any suggestion here?