Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 1, 2025

Automatically detects when PRs add new markdown files and posts a comment requesting removal or discussion with maintainers.

Implementation

  • Workflow: .github/workflows/detect-new-md-files.yml
    • Triggers: PR opened, synchronized, reopened
    • Filters for files with status: "added" and .md extension
    • Pagination support for PRs with 100+ files
    • Excludes bots (dependabot, sentry-autofix, etc.)

Behavior

Posts comment when new .md files detected:

⚠️ **New Markdown Files Detected**

This PR adds the following new .md file(s):

- `docs/new-guide.md`

Please remove these markdown files from the PR. If you believe this file is necessary, 
please create an issue to discuss it with the maintainers before adding it.

Technical Notes

  • Uses actions/github-script@v7 for GitHub API interaction
  • Error handling with stack trace logging for debugging
  • Follows existing repository patterns (bot exclusions match enforce-issue-number-in-description.yml)
  • Permissions: pull-requests: write, contents: read
Original prompt

add a github action to detect new .md files in a PR and add a comment to remove them.


💡 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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 1, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] Add GitHub Action to comment on new .md files Add GitHub Action to detect and flag new .md files in PRs Nov 1, 2025
Copilot AI requested a review from DonnieBLT November 1, 2025 15:20
@github-actions github-actions bot added unresolved-conversations: 0 PR has 0 unresolved conversations files-changed: 1 labels Nov 16, 2025
@DonnieBLT DonnieBLT marked this pull request as ready for review November 16, 2025 03:24
@DonnieBLT DonnieBLT added d15 and removed d15 labels Nov 16, 2025
@DonnieBLT DonnieBLT merged commit 0f321df into main Nov 22, 2025
5 checks passed
@DonnieBLT DonnieBLT deleted the copilot/add-github-action-remove-md-files branch November 22, 2025 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

files-changed: 1 unresolved-conversations: 0 PR has 0 unresolved conversations

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants