Skip to content

Commit

Permalink
Improve get branch from event data
Browse files Browse the repository at this point in the history
  • Loading branch information
acrobat committed Oct 29, 2021
1 parent 3595fc1 commit 7796d31
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,19 @@ async function downloadSplitsh(): Promise<void> {

console.table(subtreeSplits);

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

return;
}

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;
}

console.log('Found branch: '+branch);

Expand Down

0 comments on commit 7796d31

Please sign in to comment.