Skip to content

Commit

Permalink
Revert "Merge pull request #1 from RosemanLabs/esteban-test-release"
Browse files Browse the repository at this point in the history
This reverts commit a9f6549, reversing
changes made to 6848b3b.
  • Loading branch information
estebanlanderreche-rl committed Jul 11, 2024
1 parent a9f6549 commit 0b35c56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

26 changes: 12 additions & 14 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async function downloadSplitsh(): Promise<void> {
async function promiseAllInBatches(subtreeSplits: subtreeSplit[], batchSize: number, handler: any): Promise<void> {
let position = 0;
while (position < subtreeSplits.length) {
core.info('Processing batch ' + (position / batchSize + 1) + '/' + (Math.round(subtreeSplits.length / batchSize)));
core.info('Processing batch ' + (position / batchSize + 1) + '/'+(Math.round(subtreeSplits.length / batchSize)));

const itemsForBatch = subtreeSplits.slice(position, position + batchSize);

Expand Down Expand Up @@ -83,18 +83,16 @@ async function promiseAllInBatches(subtreeSplits: subtreeSplit[], batchSize: num
await ensureRemoteExists(split.name, split.target);
}

if (context.eventName === 'push') {
if (context.eventName === 'push' ) {
if (!context.ref.includes('refs/heads')) {
core.info('Push event was for a tag, skipping...');

return;
}
let branch = '';
if (context.ref.startsWith("origin/heads")) {
branch = context.ref.split('/').slice(2).join("/")
}
else {
core.error('Unable to get branch name from event data. Got ref "' + context.ref + '"');

const branch = context.ref.split('/').pop();
if (typeof branch == 'undefined') {
core.error('Unable to get branch name from event data. Got ref "'+context.ref+'"');

return;
}
Expand All @@ -118,14 +116,14 @@ async function promiseAllInBatches(subtreeSplits: subtreeSplit[], batchSize: num
let hash = await getExecOutput(splitshPath, [`--prefix=${split.directory}`, `--origin=tags/${tag}`]);
let clonePath = `./.repositories/${split.name}/`;

fs.mkdirSync(clonePath, { recursive: true });
fs.mkdirSync(clonePath, { recursive: true});

await exec('git', ['clone', split.target, '.'], { cwd: clonePath });
await exec('git', ['clone', split.target, '.'], { cwd: clonePath});

// TODO: smart tag skipping (skip patch releases where commit was previously tagged) minor and major releases should always get a tag

if (!await tagExists(tag, clonePath)) {
await exec('git', ['tag', '-a', tag, hash, '-m', `"Tag ${tag}"`], { cwd: clonePath });
await exec('git', ['tag', '-a', tag, hash, '-m', `"Tag ${tag}"`], {cwd: clonePath});
}
await exec('git', ['push', '--tags'], { cwd: clonePath });
});
Expand All @@ -142,12 +140,12 @@ async function promiseAllInBatches(subtreeSplits: subtreeSplit[], batchSize: num

await promiseAllInBatches(subtreeSplits, batchSize, async (split: subtreeSplit) => {
let clonePath = `./.repositories/${split.name}/`;
fs.mkdirSync(clonePath, { recursive: true });
fs.mkdirSync(clonePath, { recursive: true});

await exec('git', ['clone', split.target, '.'], { cwd: clonePath });
await exec('git', ['clone', split.target, '.'], { cwd: clonePath});

if (await tagExists(tag, clonePath)) {
await exec('git', ['push', '--delete', 'origin', tag], { cwd: clonePath });
await exec('git', ['push', '--delete', 'origin', tag], { cwd: clonePath});
}
});
}
Expand Down

0 comments on commit 0b35c56

Please sign in to comment.