Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: remove unnecessary input
  • Loading branch information
JounQin committed Apr 1, 2025
commit 72d33b0077beb0f91d25b7456d89f67e66014b60
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ GitLab CI cli for [changesets](https://github.com/atlassian/changesets) like its
- `INPUT_TARGET_BRANCH` -> The merge request target branch. Defaults to current branch
- `INPUT_CREATE_GITLAB_RELEASES` - A boolean value to indicate whether to create Gitlab releases after publish or not. Default true.
- `INPUT_LABELS` - A comma separated string of labels to be added to the version package Gitlab Merge request
- `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.

### Outputs

Expand Down
1 change: 0 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ export const main = async ({
createGitlabReleases: !FALSY_VALUES.has(
getInput('create_gitlab_releases'),
),
pushAllTags: !FALSY_VALUES.has(getInput('push_all_tags')),
})

if (result.published) {
Expand Down
18 changes: 11 additions & 7 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
getChangelogEntry,
getOptionalInput,
getVersionsByDirectory,
GITLAB_MAX_TAGS,
sortTheThings,
} from './utils.js'

Expand Down Expand Up @@ -59,7 +60,6 @@ export interface PublishOptions {
script: string
gitlabToken: string
createGitlabReleases?: boolean
pushAllTags?: boolean
cwd?: string
}

Expand All @@ -77,7 +77,6 @@ export async function runPublish({
script,
gitlabToken,
createGitlabReleases = true,
pushAllTags = true,
cwd = process.cwd(),
}: PublishOptions): Promise<PublishResult> {
const api = createApi(gitlabToken)
Expand All @@ -89,15 +88,23 @@ export async function runPublish({
{ cwd },
)

const { packages, tool } = await getPackages(cwd)

const pushAllTags =
packages.length <= GITLAB_MAX_TAGS ||
(await api.FeatureFlags.show(
context.projectId,
'git_push_create_all_pipelines',
).catch(() => false))

if (pushAllTags) {
await gitUtils.pushTags()
}

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

if (tool === 'root') {
if (packages.length === 0) {
if (packages.length !== 1) {
throw new Error(
`No package found.` +
'This is probably a bug in the action, please open an issue',
Expand All @@ -112,9 +119,6 @@ export async function runPublish({
if (match) {
releasedPackages.push(pkg)
const tagName = `v${pkg.packageJson.version}`
if (!pushAllTags) {
await gitUtils.pushTag(tagName)
}
if (createGitlabReleases) {
await createRelease(api, { pkg, tagName })
}
Expand Down
2 changes: 2 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,5 @@ export const cjsRequire =
export const FALSY_VALUES = new Set(['false', '0'])

export const TRUTHY_VALUES = new Set(['true', '1'])

export const GITLAB_MAX_TAGS = 4
Loading