Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1804,8 +1804,6 @@ const TARGET_FILE = core.getInput("TARGET_FILE");

const capitalize = (str) => str.slice(0, 1).toUpperCase() + str.slice(1);

const urlPrefix = "https://github.com";

/**
* Returns a URL in markdown format for PR's and issues
* @param {Object | String} item - holds information concerning the issue/PR
Expand All @@ -1814,12 +1812,21 @@ const urlPrefix = "https://github.com";
*/

const toUrlFormat = (item) => {
if (typeof item === "object") {
return Object.hasOwnProperty.call(item.payload, "issue")
? `[#${item.payload.issue.number}](${urlPrefix}/${item.repo.name}/issues/${item.payload.issue.number})`
: `[#${item.payload.pull_request.number}](${urlPrefix}/${item.repo.name}/pull/${item.payload.pull_request.number})`;
if (typeof item !== "object") {
return `[${item}](https://github.com/${item})`;
}

if (Object.hasOwnProperty.call(item.payload, "comment")) {
return `[#${item.payload.issue.number}](${item.payload.comment.html_url})`;
}

if (Object.hasOwnProperty.call(item.payload, "issue")) {
return `[#${item.payload.issue.number}](${item.payload.issue.html_url})`;
}

if (Object.hasOwnProperty.call(item.payload, "pull_request")) {
return `[#${item.payload.pull_request.number}](${item.payload.pull_request.html_url})`;
}
return `[${item}](${urlPrefix}/${item})`;
};

/**
Expand Down
21 changes: 14 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ const TARGET_FILE = core.getInput("TARGET_FILE");

const capitalize = (str) => str.slice(0, 1).toUpperCase() + str.slice(1);

const urlPrefix = "https://github.com";

/**
* Returns a URL in markdown format for PR's and issues
* @param {Object | String} item - holds information concerning the issue/PR
Expand All @@ -31,12 +29,21 @@ const urlPrefix = "https://github.com";
*/

const toUrlFormat = (item) => {
if (typeof item === "object") {
return Object.hasOwnProperty.call(item.payload, "issue")
? `[#${item.payload.issue.number}](${urlPrefix}/${item.repo.name}/issues/${item.payload.issue.number})`
: `[#${item.payload.pull_request.number}](${urlPrefix}/${item.repo.name}/pull/${item.payload.pull_request.number})`;
if (typeof item !== "object") {
return `[${item}](https://github.com/${item})`;
}

if (Object.hasOwnProperty.call(item.payload, "comment")) {
return `[#${item.payload.issue.number}](${item.payload.comment.html_url})`;
}

if (Object.hasOwnProperty.call(item.payload, "issue")) {
return `[#${item.payload.issue.number}](${item.payload.issue.html_url})`;
}

if (Object.hasOwnProperty.call(item.payload, "pull_request")) {
return `[#${item.payload.pull_request.number}](${item.payload.pull_request.html_url})`;
}
return `[${item}](${urlPrefix}/${item})`;
};

/**
Expand Down
4 changes: 2 additions & 2 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
@@ -1,6 +1,6 @@
{
"name": "github-activity-readme",
"version": "0.4.0",
"version": "0.5.0",
"description": "Updates README with the recent GitHub activity of a user",
"main": "index.js",
"keywords": [],
Expand Down