Add automated PR checks and Copilot instructions for common contributor mistakes - #207
Conversation
Co-authored-by: dalito <2648874+dalito@users.noreply.github.com>
Co-authored-by: dalito <2648874+dalito@users.noreply.github.com>
Co-authored-by: dalito <2648874+dalito@users.noreply.github.com>
Co-authored-by: dalito <2648874+dalito@users.noreply.github.com>
|
@copilot Interesting path to solve this. I agree that for clearly defined problems detecting the problem in an action is better than throwing an LLM at it. Putting Python code into the action is problematic since it cannot be automatically tested easily. Defer the check that new concept may not be top-level to another PR. Also the arguments why submission from an org does not work misses the main point: The option "Allow edits from maintainers" is not available for forks stored in an organization (see https://github.com/orgs/community/discussions/5634) but required for PRs in voc4cat else the action cannot commit the turtle files created from a submitted xlsx file and cannot remove the xlsx file. I was expecting the creation of instructions for Copilot by adding a .github/copilot-instructions.md file to the repository as documented here https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions |
- Remove Python-based top-concept validation (defer to separate PR) - Correct org account explanation: focus on "Allow edits from maintainers" GitHub limitation - Add .github/copilot-instructions.md for GitHub Copilot review guidance - Update documentation to reflect new approach - Simplify workflow to 1 job with 2 checks (main branch + org account) Co-authored-by: dalito <2648874+dalito@users.noreply.github.com>
I've refactored the implementation based on your feedback in commit 6cc0338:
The workflow is now simplified to 1 job with 2 checks (main branch + org account), taking ~1-2 minutes. Top-concept classification is handled via Copilot instructions for manual/AI review. CodeQL: 0 alerts |
|
@copilot On a quick look the added action is not safe against script-injection (https://github.com/actions/github-script#passing-inputs-to-the-script). Carefully review the action again for security flaws. Tools like zizmor may be of help. |
- Sanitize pr.user.login to prevent injection (alphanumeric + hyphens only) - Change console.log to use comma-separated values instead of template literals - Add security documentation explaining mitigations - Add security header comment in workflow file - Update README with security references Co-authored-by: dalito <2648874+dalito@users.noreply.github.com>
Fixed script injection vulnerabilities in commit 0f6d3ad: Mitigations implemented:
What was vulnerable:
CodeQL: 0 alerts after fixes |
- remove excessive documentation - tune messages - avoid inconsistencies between action-review and agent-review
7ad831f to
34a5185
Compare
|
I cleaned this up and removed the excessive documentation which was only relevant in the context of the joint PR development with the agent. |
…or mistakes (nfdi4cat#207) * Add PR submission checks workflow * Add .github/copilot-instructions.md for GitHub Copilot review guidance --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: dalito <2648874+dalito@users.noreply.github.com>
Implementation Complete: Automated PR Checks with Copilot Instructions ✅
This PR implements automated checks and GitHub Copilot instructions for common PR submission mistakes, addressing issue #206.
What Gets Checked
Implementation Details
Files Created:
.github/copilot-instructions.md(150 lines) - Comprehensive guidance for Copilot reviews.github/workflows/pr-checks.yml(189 lines) - Secure workflow with 2 checks.github/workflows/SECURITY.md- Security documentation and mitigations.github/workflows/README-pr-checks.md- Documentation and maintenance guide.github/workflows/TESTING-pr-checks.md- Testing plan adapted for new approachIMPLEMENTATION-SUMMARY.md- Complete summaryFiles Modified:
CONTRIBUTING.md- Added best practices about feature branchesChanges from Initial Implementation
Per @dalito's feedback:
.github/copilot-instructions.mdas expected approach for Copilot guidanceSecurity Mitigations
Per @dalito's security review:
pr.user.loginwith regex to allow only alphanumeric + hyphensKey Features
✅ Helpful, Not Blocking - Main branch check is informational; org account is critical (literally can't work)
✅ Friendly Tone - Comments are welcoming and educational
✅ No Spam - Comments posted only once
✅ Secure - Script injection prevention, minimal permissions, no code checkout
✅ Validated - CodeQL: 0 alerts
✅ Expected Approach - Uses Copilot instructions + minimal Actions
Technical Implementation
Testing Status
TESTING-pr-checks.mdfor test scenariosSECURITY.mdfor security testing proceduresNext Steps
See
IMPLEMENTATION-SUMMARY.mdandSECURITY.mdfor complete details.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.