Skip to content

Commit

Permalink
Bump version 1.0.7 -> 1.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
satterly committed May 20, 2020
1 parent 955d71e commit ac54385
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 38 deletions.
39 changes: 14 additions & 25 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10774,7 +10774,7 @@ function stepIcon(status) {
return `:grey_question: ${status}`;
}
function send(url, jobName, jobStatus, jobSteps, channel) {
var _a, _b, _c, _d, _e, _f, _g, _h;
var _a, _b, _c, _d, _e, _f, _g;
return __awaiter(this, void 0, void 0, function* () {
core.debug(JSON.stringify(github_1.context.payload, null, 2));
const workflow = github_1.context.workflow;
Expand Down Expand Up @@ -10843,40 +10843,29 @@ function send(url, jobName, jobStatus, jobSteps, channel) {
// })
}
let commit, branch, compare;
if (github_1.context.eventName === 'create') {
commit = {
id: github_1.context.sha,
url: `${repositoryUrl}/commit/${github_1.context.sha}`,
message: 'new branch or tag'
};
branch = (_a = github_1.context.ref) === null || _a === void 0 ? void 0 : _a.replace('refs/heads/', '');
compare = `${commit.url}`; // FIXME - not sure this makes sense
}
else if (github_1.context.eventName === 'push') {
if (github_1.context.eventName === 'push') {
commit = github_1.context.payload.head_commit;
branch = (_b = github_1.context.ref) === null || _b === void 0 ? void 0 : _b.replace('refs/heads/', '');
branch = (_a = github_1.context.ref) === null || _a === void 0 ? void 0 : _a.replace('refs/heads/', '');
compare = github_1.context.payload.compare;
}
else if (github_1.context.eventName === 'pull_request') {
commit = {
id: (_c = github_1.context.payload.pull_request) === null || _c === void 0 ? void 0 : _c.head.sha,
url: (_d = github_1.context.payload.pull_request) === null || _d === void 0 ? void 0 : _d.html_url,
message: (_e = github_1.context.payload.pull_request) === null || _e === void 0 ? void 0 : _e.title
id: (_b = github_1.context.payload.pull_request) === null || _b === void 0 ? void 0 : _b.head.sha,
url: (_c = github_1.context.payload.pull_request) === null || _c === void 0 ? void 0 : _c.html_url,
message: (_d = github_1.context.payload.pull_request) === null || _d === void 0 ? void 0 : _d.title
};
branch = (_f = github_1.context.payload.pull_request) === null || _f === void 0 ? void 0 : _f.head.ref;
branch = (_e = github_1.context.payload.pull_request) === null || _e === void 0 ? void 0 : _e.head.ref;
compare = `${commit.url}/files`;
}
else if (github_1.context.eventName === 'release') {
commit = {
else {
;
(commit = {
id: github_1.context.sha,
url: `${repositoryUrl}/commit/${github_1.context.sha}`,
message: 'new branch or tag'
};
branch = (_g = github_1.context.ref) === null || _g === void 0 ? void 0 : _g.replace('refs/tags/', '');
compare = `${commit.url}`; // FIXME - not sure this makes sense
}
else {
core.setFailed(`Unsupported event type "${github_1.context.eventName}"`);
}),
(branch = (_f = github_1.context.ref) === null || _f === void 0 ? void 0 : _f.replace('refs/tags/', '').replace('refs/heads/', '')),
(compare = `${commit.url}`); // FIXME - not sure this makes sense
}
const text = `*<${commit.url}/checks|Workflow _${workflow}_ ` +
`job _${jobName}_ triggered by _${eventName}_ is _${jobStatus}_>* ` +
Expand All @@ -10895,7 +10884,7 @@ function send(url, jobName, jobStatus, jobSteps, channel) {
short: false
});
}
const ts = new Date((_h = github_1.context.payload.repository) === null || _h === void 0 ? void 0 : _h.pushed_at);
const ts = new Date((_g = github_1.context.payload.repository) === null || _g === void 0 ? void 0 : _g.pushed_at);
const message = {
username: 'GitHub Action',
icon_url: 'https://octodex.github.com/images/original.png',
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "slack",
"version": "1.0.7",
"version": "1.0.8",
"private": true,
"description": "Notify Slack of GitHub Actions job and step status.",
"main": "lib/main.js",
Expand Down
22 changes: 11 additions & 11 deletions src/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,28 +98,28 @@ async function send(
// })
}

let commit = {
id: context.sha,
url: `${repositoryUrl}/commit/${context.sha}`,
message: 'new branch or tag'
},
branch = context.ref?.replace('refs/tags/', '').replace('refs/heads/', ''),
compare = `${commit.url}` // FIXME - not sure this makes sense

if (context.eventName === 'push') {
let commit, branch, compare

if (context.eventName === 'push') {
commit = context.payload.head_commit
branch = context.ref?.replace('refs/heads/', '')
compare = context.payload.compare
} else if (context.eventName === 'pull_request') {
commit = {
id: context.payload.pull_request?.head.sha,
url: context.payload.pull_request?.html_url || '',
url: context.payload.pull_request?.html_url,
message: context.payload.pull_request?.title
}
branch = context.payload.pull_request?.head.ref
compare = `${commit.url}/files`
} else {
core.setFailed(`Unsupported event type "${context.eventName}"`)
;(commit = {
id: context.sha,
url: `${repositoryUrl}/commit/${context.sha}`,
message: 'new branch or tag'
}),
(branch = context.ref?.replace('refs/tags/', '').replace('refs/heads/', '')),
(compare = `${commit.url}`) // FIXME - not sure this makes sense
}

const text =
Expand Down

0 comments on commit ac54385

Please sign in to comment.