Skip to content

Commit

Permalink
Run Prettier to resolve code style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kazvee committed Nov 1, 2023
1 parent 08b5c84 commit e78c7ee
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/issue-metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
body: comment
})
}
}
}
35 changes: 18 additions & 17 deletions issue-metrics.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
const core = require('@actions/core');
const github = require('@actions/github');
const core = require('@actions/core')
const github = require('@actions/github')

const assignedIssues = {};
const assignedIssues = {}

const main = async () => {
const payload = JSON.parse(core.getInput('payload'));
const payload = JSON.parse(core.getInput('payload'))

if (payload.action === 'assigned') {
const issue = payload.issue;
assignedIssues[issue.number] = issue.assignee.login;
const issue = payload.issue
assignedIssues[issue.number] = issue.assignee.login
}

if (payload.action === 'unlabeled' && payload.label.name === 'assigned') {
delete assignedIssues[payload.issue.number];
delete assignedIssues[payload.issue.number]
}

if (payload.action === 'opened') {
const pull = payload.pull_request;
const issueNumber = pull.title.split('#')[1];
const pull = payload.pull_request
const issueNumber = pull.title.split('#')[1]

if (issueNumber && assignedIssues[issueNumber]) {
const timeDelta = new Date(pull.created_at) - new Date(assignedIssues[issueNumber]);
const timeDelta =
new Date(pull.created_at) - new Date(assignedIssues[issueNumber])

const comment = `Time from assignment to PR for #${issueNumber}: ${timeDelta} ms`;
const comment = `Time from assignment to PR for #${issueNumber}: ${timeDelta} ms`

const octokit = github.getOctokit(core.getInput('github-token'));
const octokit = github.getOctokit(core.getInput('github-token'))

await octokit.issues.createComment({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
issue_number: pull.number,
body: comment,
});
body: comment
})
}
}
};
}

main().catch((error) => {
core.setFailed(error.message);
});
core.setFailed(error.message)
})

0 comments on commit e78c7ee

Please sign in to comment.