Skip to content

Commit

Permalink
fix action
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen committed Sep 29, 2021
1 parent 6fe9642 commit 2609ef8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
18 changes: 14 additions & 4 deletions action-src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { error, getInput, setFailed, setOutput } from '@actions/core';
import { error, getInput, setFailed, setOutput, info } from '@actions/core';
import { context } from '@actions/github';
import { readFile } from 'jsonfile';
import pkgUp from 'pkg-up';
Expand Down Expand Up @@ -43,8 +43,15 @@ const getBuildInfo = (event: typeof context) => {
};
}
case 'workflow_run': {
console.log(event.payload);
return {};
const { repository } = event.payload;
// eslint-disable-next-line @typescript-eslint/naming-convention
const { head_sha, head_branch } = event.payload.workflow_run;

return {
sha: head_sha,
branch: head_branch.replace('refs/heads/', ''),
slug: repository.full_name,
};
}
case 'workflow_dispatch': {
const { ref, sha } = event.payload.inputs;
Expand Down Expand Up @@ -190,4 +197,7 @@ async function run() {
process.exit(1);
}
}
run();
run().catch((e) => {
error(e);
setFailed(e.message);
});
6 changes: 3 additions & 3 deletions action-src/register.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Observable from 'zen-observable';
const Observable = require('zen-observable');

global.Observable = Observable;
(await import('any-observable/register'))('global.Observable');
require('any-observable/register')('global.Observable');

await import('./main');
require('./main');

0 comments on commit 2609ef8

Please sign in to comment.