Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Include/ignore patterns are matched against the GitHub API URL instead of the repository-relative path

Aperta
#215 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@strawberry-little-bear ci sta già lavorando.

Dal 22/10/2026.

  • #216 di @strawberry-little-bear — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
javascript, node.js
Ambito
backend, devtools

Direzione di ricerca

Start in src/bot.ts and trace how changed file paths are passed to matchPatterns for include and ignore rules. Compare that input with file.filename, which the issue says is already used for IGNORE; confirm the behavior with the reproduction in the issue. Done means patterns are matched against repository-relative filenames, so API URL segments cannot affect filtering.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

INCLUDE_PATTERNS and IGNORE_PATTERNS are matched against the pathname of GitHub's contents_url, rather than the repository-relative file path. That pathname includes API metadata:

/repos/{owner}/{repo}/contents/{path}

Consequently, a pattern can accidentally match the owner or repository name. For example, in a repository named docs, with this changed file:

filename:     src/app.ts
contents_url: https://api.github.com/repos/example/docs/contents/src/app.ts

and this configuration:

INCLUDE_PATTERNS: docs/**

the current code constructs **/docs/** and matches /repos/example/docs/contents/src/app.ts, so src/app.ts is reviewed even though it is not under a top-level docs/ directory. The same collision means IGNORE_PATTERNS: docs/** can ignore every changed file in a repository named docs.

Expected behavior

Include/ignore patterns should be evaluated against the repository-relative filename (file.filename, which is already used for IGNORE), so API path segments such as repos, the owner, the repository name, and contents cannot participate in matching.

Reproduction

I reproduced the behavior with the project's matchPatterns logic and [email protected]:

minimatch(
  '/repos/example/docs/contents/src/app.ts',
  '**/docs/**'
); // true

The expected input for this file is instead:

minimatch('src/app.ts', '**/docs/**'); // false

The relevant code is in src/bot.ts, where decodeURIComponent(new URL(file.contents_url).pathname) is passed to matchPatterns.

Impact

This is a functional filtering bug: include/ignore rules can select or exclude unrelated files whenever a pattern collides with the repository's API pathname components. It is particularly visible when a directory pattern has the same name as the repository, but the same issue applies to any pattern intended to match only repository paths.

Lingua principale
JavaScript
Stelle
4.5k
Fork
465
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di anc95/ChatGPT-CodeReview

Tutte le issue di anc95/ChatGPT-CodeReview

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.