Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
grmoon committed Oct 30, 2020
1 parent 77e910c commit 9775a28
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions src/autoupdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ async function fetchPullRequests(octokit, repo, base) {
const response = await octokit.pulls.list({ ...repo, base, state: "open" });
const prs = response.data;

if (prs.length == 0) {
if (prs) {
core.info(`No PRs have ${base} as their base branch.`);
} else {
core.info(`The following PRs have ${base} as their base branch:`, prs);
core.info(
`The following PRs have ${base} as their base branch: ${prs.join(", ")}`
);
}

core.endGroup();
Expand All @@ -64,7 +66,7 @@ function filterPullRequests(pullRequests, base) {
`No PRs with ${base} as their base branch have the "autoupdate" label.`
);
} else {
core.info(`The following PRs will be updated:`, prsToUpdate);
core.info(`The following PRs will be updated: ${prsToUpdate.join(", ")}`);
}

core.endGroup();
Expand All @@ -91,7 +93,7 @@ module.exports = async function autoupdater(github, { GITHUB_TOKEN } = {}) {
const { repo, ref: base } = github.context;

const pullRequests = await fetchPullRequests(octokit, repo, base);
const prsToUpdate = filterPullRequests(pullRequests);
const prsToUpdate = filterPullRequests(pullRequests, base);

return updatePullRequests(prsToUpdate, repo, octokit);
};

0 comments on commit 9775a28

Please sign in to comment.