Skip to content

Commit

Permalink
build(release): compiled action for 1.4.1
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
semantic-release-bot committed Jan 27, 2020
1 parent 6e2dca9 commit 841f971
Showing 1 changed file with 55 additions and 28 deletions.
83 changes: 55 additions & 28 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7568,42 +7568,70 @@ module.exports = createCheckRun;

const { autoLink } = __webpack_require__(914);

function createCheckRun({ octokit, payload, startedAt }, newTweets) {
async function createCheckRun(
{ octokit, payload, startedAt, toolkit },
newTweets
) {
const allTweetsValid = newTweets.every(tweet => tweet.valid);

return octokit.request("POST /repos/:owner/:repo/check-runs", {
headers: {
accept: "application/vnd.github.antiope-preview+json"
},
owner: payload.repository.owner.login,
repo: payload.repository.name,
name: "preview",
head_sha: payload.pull_request.head.sha,
started_at: startedAt,
completed_at: new Date().toISOString(),
status: "completed",
conclusion: allTweetsValid ? "success" : "failure",
output: {
title: `${newTweets.length} tweet(s)`,
summary: newTweets
.map(tweet => {
const text = autoLink(tweet.text).replace(/(^|\n)/g, "$1> ");

if (tweet.valid) {
return `### ✅ Valid
// Check runs cannot be created if the pull request was created by a fork,
// so we just log out the result.
// https://help.github.com/en/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token#permissions-for-the-github_token
if (payload.pull_request.head.repo.fork) {
for (const tweet of newTweets) {
if (tweet.valid) {
toolkit.info(`### ✅ Valid

${tweet.text}`);
} else {
toolkit.info(`### ❌ Invalid

${tweet.text}

The above tweet is ${tweet.weightedLength - 280} characters too long`);
}
}
process.exit(allTweetsValid ? 0 : 1);
}

const response = await octokit.request(
"POST /repos/:owner/:repo/check-runs",
{
headers: {
accept: "application/vnd.github.antiope-preview+json"
},
owner: payload.repository.owner.login,
repo: payload.repository.name,
name: "preview",
head_sha: payload.pull_request.head.sha,
started_at: startedAt,
completed_at: new Date().toISOString(),
status: "completed",
conclusion: allTweetsValid ? "success" : "failure",
output: {
title: `${newTweets.length} tweet(s)`,
summary: newTweets
.map(tweet => {
const text = autoLink(tweet.text).replace(/(^|\n)/g, "$1> ");

if (tweet.valid) {
return `### ✅ Valid

${text}`;
}
}

return `### ❌ Invalid
return `### ❌ Invalid

${text}

The above tweet is ${tweet.weightedLength - 280} characters too long`;
})
.join("\n\n---\n\n")
})
.join("\n\n---\n\n")
}
}
});
);

toolkit.info(`check run created: ${response.data.html_url}`);
}


Expand Down Expand Up @@ -36752,8 +36780,7 @@ async function handlePullRequest(state) {
});

const newTweets = await getNewTweets(state);
const response = await createCheckRun(state, newTweets);
toolkit.info(`check run created: ${response.data.html_url}`);
await createCheckRun(state, newTweets);
}


Expand Down

0 comments on commit 841f971

Please sign in to comment.