Skip to content

Commit 72d33b0

Browse files
committed
refactor: remove unnecessary input
1 parent 44e57a3 commit 72d33b0

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ GitLab CI cli for [changesets](https://github.com/atlassian/changesets) like its
3131
- `INPUT_TARGET_BRANCH` -> The merge request target branch. Defaults to current branch
3232
- `INPUT_CREATE_GITLAB_RELEASES` - A boolean value to indicate whether to create Gitlab releases after publish or not. Default true.
3333
- `INPUT_LABELS` - A comma separated string of labels to be added to the version package Gitlab Merge request
34-
- `INPUT_PUSH_ALL_TAGS` - A boolean value to indicate whether to push all tags at once using `git push origin --tags`, see [#194](https://github.com/un-ts/changesets-gitlab/issues/194) for details. Default true.
3534

3635
### Outputs
3736

src/main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ export const main = async ({
8888
createGitlabReleases: !FALSY_VALUES.has(
8989
getInput('create_gitlab_releases'),
9090
),
91-
pushAllTags: !FALSY_VALUES.has(getInput('push_all_tags')),
9291
})
9392

9493
if (result.published) {

src/run.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
getChangelogEntry,
2020
getOptionalInput,
2121
getVersionsByDirectory,
22+
GITLAB_MAX_TAGS,
2223
sortTheThings,
2324
} from './utils.js'
2425

@@ -59,7 +60,6 @@ export interface PublishOptions {
5960
script: string
6061
gitlabToken: string
6162
createGitlabReleases?: boolean
62-
pushAllTags?: boolean
6363
cwd?: string
6464
}
6565

@@ -77,7 +77,6 @@ export async function runPublish({
7777
script,
7878
gitlabToken,
7979
createGitlabReleases = true,
80-
pushAllTags = true,
8180
cwd = process.cwd(),
8281
}: PublishOptions): Promise<PublishResult> {
8382
const api = createApi(gitlabToken)
@@ -89,15 +88,23 @@ export async function runPublish({
8988
{ cwd },
9089
)
9190

91+
const { packages, tool } = await getPackages(cwd)
92+
93+
const pushAllTags =
94+
packages.length <= GITLAB_MAX_TAGS ||
95+
(await api.FeatureFlags.show(
96+
context.projectId,
97+
'git_push_create_all_pipelines',
98+
).catch(() => false))
99+
92100
if (pushAllTags) {
93101
await gitUtils.pushTags()
94102
}
95103

96-
const { packages, tool } = await getPackages(cwd)
97104
const releasedPackages: Package[] = []
98105

99106
if (tool === 'root') {
100-
if (packages.length === 0) {
107+
if (packages.length !== 1) {
101108
throw new Error(
102109
`No package found.` +
103110
'This is probably a bug in the action, please open an issue',
@@ -112,9 +119,6 @@ export async function runPublish({
112119
if (match) {
113120
releasedPackages.push(pkg)
114121
const tagName = `v${pkg.packageJson.version}`
115-
if (!pushAllTags) {
116-
await gitUtils.pushTag(tagName)
117-
}
118122
if (createGitlabReleases) {
119123
await createRelease(api, { pkg, tagName })
120124
}

src/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,5 @@ export const cjsRequire =
175175
export const FALSY_VALUES = new Set(['false', '0'])
176176

177177
export const TRUTHY_VALUES = new Set(['true', '1'])
178+
179+
export const GITLAB_MAX_TAGS = 4

0 commit comments

Comments
 (0)