Skip to content

Commit

Permalink
chore: pass github, add issue comment (#5469)
Browse files Browse the repository at this point in the history
* Update close-invalid-link.cjs

* Update close-invalid-link.cjs
  • Loading branch information
sofisl authored Jun 14, 2024
1 parent 889151e commit c89ced9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/scripts/close-invalid-link.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.

async function closeIssue(owner, repo, number) {
async function closeIssue(github, owner, repo, number) {
await github.rest.issues.createComment({
owner: owner,
repo: repo,
issue_number: number,
body: "Issue was opened with an invalid reproduction link. Please make sure the repository is a valid, publicly-accessible github repository, and make sure the url is complete (example: https://github.com/googleapis/google-cloud-node)"
});
await github.rest.issues.update({
owner: owner,
repo: repo,
issue_number: number,
state: "closed",
state: "closed"
});
}
module.exports = async ({ github, context }) => {
Expand All @@ -38,10 +44,10 @@ module.exports = async ({ github, context }) => {
const link = issue.data.body.split("\n")[18].match(/(https?:\/\/g?i?s?t\.?github.com\/.*)/);
const isValidLink = (await fetch(link)).ok;
if (!isValidLink) {
await closeIssue(owner, repo, number);
await closeIssue(github, owner, repo, number);
}
} catch (err) {
await closeIssue(owner, repo, number);
await closeIssue(github, owner, repo, number);
}
}
};

1 comment on commit c89ced9

@Bechtol420
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never abandoned anything. I did participate. some times events out our control. Such as false accusations hinder ones ability to take care of personal affairs.

Please sign in to comment.