Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
breathingdust committed Feb 28, 2023
1 parent a11fbf3 commit fb599cd
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 45 deletions.
107 changes: 82 additions & 25 deletions 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
Expand Up @@ -24,7 +24,7 @@
"dependencies": {
"@actions/core": "^1.2.4",
"@actions/github": "^3.0.0",
"axios": "^0.19.2"
"axios": "^1.3.4"
},
"devDependencies": {
"@vercel/ncc": "^0.36.1",
Expand Down
40 changes: 21 additions & 19 deletions index.js → src/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const core = require('@actions/core');
const github = require('@actions/github');
const axios = require('axios');
const core = require("@actions/core");
const github = require("@actions/github");
const axios = require("axios");

async function main() {
const githubToken = core.getInput('github_token');
const org = core.getInput('org');
const repo = core.getInput('repo');
const teamSlug = core.getInput('team_slug');
const slackToken = core.getInput('slack_token');
const slackChannel = core.getInput('slack_channel');
const githubToken = core.getInput("github_token");
const org = core.getInput("org");
const repo = core.getInput("repo");
const teamSlug = core.getInput("team_slug");
const slackToken = core.getInput("slack_token");
const slackChannel = core.getInput("slack_channel");

const octokit = github.getOctokit(githubToken);

Expand Down Expand Up @@ -55,38 +55,40 @@ async function main() {
return 0;
});

core.setOutput('stats', JSON.stringify(searchResults));
core.setOutput("stats", JSON.stringify(searchResults));

let memberLines = '';
let memberLines = "";

searchResults.forEach((member) => { memberLines += `<https://github.com/search?q=repo:${org}/${repo}+author:${member.member}+is:pr+is:open+draft:false|${member.member}> : ${member.count}\n`; });
searchResults.forEach((member) => {
memberLines += `<https://github.com/search?q=repo:${org}/${repo}+author:${member.member}+is:pr+is:open+draft:false|${member.member}> : ${member.count}\n`;
});

const postMessageBody = {
channel: slackChannel,
blocks: [
{
type: 'section',
type: "section",
text: {
type: 'mrkdwn',
type: "mrkdwn",
text: `Open Pull Requests in *${org}/${repo}* :rocket:`,
},
},
{
type: 'divider',
type: "divider",
},
{
type: 'section',
type: "section",
text: {
type: 'mrkdwn',
type: "mrkdwn",
text: memberLines,
},
},
],
};

axios({
method: 'post',
url: 'https://slack.com/api/chat.postMessage',
method: "post",
url: "https://slack.com/api/chat.postMessage",
headers: { Authorization: `Bearer ${slackToken}` },
data: postMessageBody,
})
Expand Down

0 comments on commit fb599cd

Please sign in to comment.