Skip to content

Commit 5244982

Browse files
committed
wip
1 parent 96bbd4f commit 5244982

File tree

7 files changed

+47
-39
lines changed

7 files changed

+47
-39
lines changed

actions/bump-all-packages/action.yml renamed to actions/changeset-bump-packages/action.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
name: 'Bump All Packages'
2-
description: 'Bumps major version for all packages in target directories using changesets'
1+
name: 'Changeset Bump Packages'
2+
description: 'Bump packages in target directories using changesets'
33

44
inputs:
55
message:
66
description: 'Message to commit'
77
required: true
8+
89
target-directories:
910
description: 'List of directories containing packages to bump'
1011
required: true
12+
1113
change-type:
1214
description: 'Type of version bump to apply'
1315
required: true
16+
1417
runs:
1518
using: node20
1619
main: 'dist/index.js'
17-

actions/bump-all-packages/dist/index.js renamed to actions/changeset-bump-packages/dist/index.js

Lines changed: 24 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { getArrayInput, getStringInput } from '@elementor-editor-github-actions/
55
import * as fs from 'fs';
66
import { glob } from 'glob';
77

8-
const packagesDir = 'packages';
98
export async function run() {
109
try {
1110
const inputs = parseInputs();
@@ -15,14 +14,18 @@ export async function run() {
1514
message
1615
} = inputs;
1716

18-
await core.group('Configuring git user', async () => {
17+
await core.group('Validating git user configuration', async () => {
1918
try {
20-
await exec.exec('git', ['config', 'user.name', 'GitHub Actions']);
21-
await exec.exec('git', ['config', 'user.email', '[email protected]']);
19+
const userName = await exec.getExecOutput('git', ['config', 'user.name']);
20+
const userEmail = await exec.getExecOutput('git', ['config', 'user.email']);
2221

23-
core.info('Git user configured');
22+
if (!userName.stdout.trim() || !userEmail.stdout.trim()) {
23+
throw new Error('Git user is not configured properly');
24+
}
25+
26+
core.info('Git user is properly configured');
2427
} catch (error) {
25-
throw new Error(`Failed to configure git user: ${error}`);
28+
throw new Error(`Failed to validate git user configuration: ${error}`);
2629
}
2730
});
2831

@@ -33,9 +36,7 @@ export async function run() {
3336

3437
for (const dir of targetDirectories) {
3538
try {
36-
const packageJsonFiles = await glob(`${packagesDir}/${dir}/**/package.json`, {
37-
ignore: ['**/node_modules/**']
38-
});
39+
const packageJsonFiles = await glob(`${dir}/*/package.json`);
3940

4041
for (const packageJsonPath of packageJsonFiles) {
4142
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
@@ -50,7 +51,11 @@ export async function run() {
5051
if (packageNames.length > 0) {
5152
core.info(`Found ${packageNames.length} packages to bump in target directories`);
5253

53-
const changesetId = Math.random().toString(36).substring(2, 12);
54+
await exec.exec('npx', ['changeset', 'add', '--empty']);
55+
56+
const fileNames = await exec.getExecOutput('ls', ['-t', '.changeset']);
57+
58+
const changesetId = fileNames.stdout.trim().split('\n')[0];
5459
const changesetDir = '.changeset';
5560

5661
if (!fs.existsSync(changesetDir)) {
@@ -81,7 +86,7 @@ export async function run() {
8186

8287
await core.group('Committing version changes', async () => {
8388
try {
84-
await exec.exec('git', ['add', '.']);
89+
await exec.exec('git', ['add', '.changeset']);
8590
await exec.exec('git', ['commit', '-m', message]);
8691

8792
await exec.exec('git', ['push']);

actions/bump-all-packages/package.json renamed to actions/changeset-bump-packages/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@elementor-editor-github-actions/bump-all-packages",
2+
"name": "@elementor-editor-github-actions/changeset-bump-packages",
33
"author": "Elementor Team",
44
"license": "GPL-3.0-or-later",
55
"private": true,
File renamed without changes.

actions/trickle-down-changelog/dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)