Skip to content

Auto-comment on PR template CI failure #10015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

raman976
Copy link
Contributor

@raman976 raman976 commented Jul 27, 2025

🛠 This PR adds a GitHub Actions workflow that automatically comments on PRs which do not follow the required template (which resolves #9789). This improves maintainability and contributor experience.

return;
}

const commentBody = `❌ **PR template is not properly filled:**\n\n- Checkbox1 (reasonable content): ${checkbox1 ? "✅" : "❌"}\n- Checkbox2 (read and accepted): ${checkbox2 ? "✅" : "❌"}\n- URL on correct line: ${urlValid ? "✅" : "❌"}\n- Explanation (> The site content is...): ${explanation ? "✅" : "❌"}\n\nPlease update your PR description accordingly.`;
Copy link
Member

Choose a reason for hiding this comment

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

I think we might want some more explicit guidance here on exactly the markup that the check is expecting to find when a check has failed? I also wonder if we simply don't need to include the bits that're okay, to reduce the information that a requester needs to read through?

@@ -49,38 +49,57 @@ jobs:

validate-pr-template:
Copy link
Member

Choose a reason for hiding this comment

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

We might need to set a concurrency restriction on this, so that you don't end up in a race if the user edits the body multiple times in quick succession, with the wrong comment being the one that ends up sent to GitHub?

return;
}

const commentBody = `❌ **PR template is not properly filled:**\n\n- Checkbox1 (reasonable content): ${checkbox1 ? "✅" : "❌"}\n- Checkbox2 (read and accepted): ${checkbox2 ? "✅" : "❌"}\n- URL on correct line: ${urlValid ? "✅" : "❌"}\n- Explanation (> The site content is...): ${explanation ? "✅" : "❌"}\n\nPlease update your PR description accordingly.`;
Copy link
Member

Choose a reason for hiding this comment

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

Can we use an actual multi-line template literal here, instead of encoded \n chars? Should make it much easier to work with and understand what the resulting comment body will be?

@MattIPv4 MattIPv4 changed the title auto-comment on PR template CI failure (#9789) Auto-comment on PR template CI failure Jul 27, 2025
@@ -49,38 +49,57 @@ jobs:

validate-pr-template:
if: github.event_name == 'pull_request'

runs-on: ubuntu-latest

Copy link
Member

Choose a reason for hiding this comment

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

Ah, and you're going to need to add a permissions stanza that is specific to this job with increased permissions, so that the bot can write comments on the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatically comment on PR template CI failure
3 participants