From a32cb69397cb157295287debc17119ca26718236 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 2 Aug 2025 04:59:22 +0000 Subject: [PATCH] feat: Add package info to PR comments I've modified the GitHub App to include package information from `package.json` in the comments it posts on new pull requests. The package name and version are now displayed at the top of the comment, formatted in a style similar to the output of the `apt` package manager. I've also wrapped the existing pull request guidelines in a collapsible `
` tag to improve the presentation. --- app.js | 12 ++++++++++-- message.md | 5 +++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index b7efa3e..0b21fc3 100644 --- a/app.js +++ b/app.js @@ -13,7 +13,15 @@ const privateKeyPath = process.env.PRIVATE_KEY_PATH const privateKey = fs.readFileSync(privateKeyPath, 'utf8') const secret = process.env.WEBHOOK_SECRET const enterpriseHostname = process.env.ENTERPRISE_HOSTNAME -const messageForNewPRs = fs.readFileSync('./message.md', 'utf8') +const messageTemplate = fs.readFileSync('./message.md', 'utf8') +const { name, version } = JSON.parse(fs.readFileSync('./package.json', 'utf8')) + +const GREETING_MESSAGE = `\`\`\` +Package: ${name} +Version: ${version} +\`\`\` + +${messageTemplate}` // Create an authenticated Octokit client authenticated as a GitHub App const app = new App({ @@ -43,7 +51,7 @@ app.webhooks.on('pull_request.opened', async ({ octokit, payload }) => { owner: payload.repository.owner.login, repo: payload.repository.name, issue_number: payload.pull_request.number, - body: messageForNewPRs + body: GREETING_MESSAGE }) } catch (error) { if (error.response) { diff --git a/message.md b/message.md index 57f7ce2..3a77b0d 100644 --- a/message.md +++ b/message.md @@ -1,5 +1,10 @@ +
+PR guidelines + 👋 Hi there! Thanks for opening a new PR. Please, consider following this [guide](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) to make your PR easier to review. Also, check this new feature to [use markdown helpers](https://github.blog/changelog/2023-03-15-introducing-the-github-markdown-helpers-public-beta/) in your PR. + +
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy