Skip to content

Commit 25a4bf7

Browse files
chore: add AGENTS.md and limit open PRs to 3 per author
1 parent 07c09d6 commit 25a4bf7

4 files changed

Lines changed: 168 additions & 0 deletions

File tree

‎.github/ISSUE_TEMPLATE/file_reservation.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ assignees: ''
88

99
<!---
1010
Dikkat, bir rezervasyon sadece bir ay geçerlidir, gerekirse yorum yaparak yenileyin.
11+
Aynı anda en fazla 3 açık pull request'iniz olabilir. Daha fazlası ``too-many-prs`` etiketiyle işaretlenir.
1112
-->

‎.github/workflows/pr_limit.yml‎

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: pr-limit
2+
# Contributors may have at most MAX_OPEN_PRS open pull requests at a time.
3+
# This labels and comments on pull requests over the limit,
4+
# and removes the label once the author is back under it.
5+
#
6+
# pull_request_target runs with a write token, so this workflow must never
7+
# check out or run code from the pull request. It only calls the GitHub API.
8+
on:
9+
pull_request_target:
10+
types: [opened, reopened, closed]
11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
env:
15+
MAX_OPEN_PRS: 3
16+
LABEL: too-many-prs
17+
jobs:
18+
check:
19+
runs-on: ubuntu-latest
20+
# Maintainers and bots are exempt.
21+
if: >-
22+
github.event.pull_request.user.type != 'Bot' &&
23+
!contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)
24+
steps:
25+
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
26+
with:
27+
script: |
28+
const max = Number(process.env.MAX_OPEN_PRS);
29+
const label = process.env.LABEL;
30+
const { owner, repo } = context.repo;
31+
const pr = context.payload.pull_request;
32+
const author = pr.user.login;
33+
34+
const open = (
35+
await github.paginate(github.rest.pulls.list, {
36+
owner, repo, state: "open", per_page: 100,
37+
})
38+
).filter((p) => p.user.login === author);
39+
core.info(`${author} has ${open.length} open pull request(s).`);
40+
41+
const hasLabel = (p) => p.labels.some((l) => l.name === label);
42+
43+
if (context.payload.action === "closed") {
44+
if (open.length > max) return;
45+
for (const p of open.filter(hasLabel)) {
46+
await github.rest.issues.removeLabel({
47+
owner, repo, issue_number: p.number, name: label,
48+
});
49+
}
50+
return;
51+
}
52+
53+
if (open.length <= max) return;
54+
55+
try {
56+
await github.rest.issues.getLabel({ owner, repo, name: label });
57+
} catch (error) {
58+
if (error.status !== 404) throw error;
59+
await github.rest.issues.createLabel({
60+
owner, repo, name: label, color: "D93F0B",
61+
description: `Author has more than ${max} open pull requests`,
62+
});
63+
}
64+
await github.rest.issues.addLabels({
65+
owner, repo, issue_number: pr.number, labels: [label],
66+
});
67+
68+
const readme = `${context.serverUrl}/${owner}/${repo}/blob/HEAD/README.md`;
69+
const list = open
70+
.filter((p) => p.number !== pr.number)
71+
.map((p) => `- #${p.number}`)
72+
.join("\n");
73+
await github.rest.issues.createComment({
74+
owner, repo, issue_number: pr.number,
75+
body: [
76+
`Merhaba @${author}, katkınız için teşekkürler!`,
77+
"",
78+
`Şu anda ${open.length} açık pull request'iniz var.`,
79+
`Her katkıyı dikkatle inceleyebilmek için bir kişinin aynı anda en fazla ${max} açık pull request'i olabilir.`,
80+
"Lütfen yeni bir pull request açmadan önce açık olanlardan birinin birleştirilmesini ya da kapatılmasını bekleyin.",
81+
"",
82+
"Diğer açık pull request'leriniz:",
83+
list,
84+
"",
85+
`Ayrıntılar için [README](${readme}) dosyasına bakabilirsiniz.`,
86+
].join("\n"),
87+
});

‎AGENTS.md‎

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# AGENTS.md
2+
3+
Guidance for coding agents (Claude Code, Codex, Copilot, Cursor, and others)
4+
working in this repository.
5+
The human-facing guide is [README.md](README.md), written in Turkish.
6+
When the two disagree, the README wins.
7+
8+
## What this repository is
9+
10+
The Turkish translation of the Python documentation.
11+
Each `.po` file mirrors one `.rst` file under `Doc/` in
12+
[python/cpython](https://github.com/python/cpython),
13+
at the path and branch named in the `Makefile`
14+
(`BRANCH` and `CPYTHON_CURRENT_COMMIT`).
15+
16+
- The default branch is `3.15`. Open pull requests against it.
17+
- `msgid` is the English source. Only `msgstr` is translated.
18+
- Never edit a `msgid`, the file header, or the `#:` location comments by hand.
19+
`merge.py` regenerates them from CPython once a month (`.github/workflows/update_doc.yml`).
20+
21+
## Contribution rules
22+
23+
- **At most 3 open pull requests per author at a time.**
24+
`.github/workflows/pr_limit.yml` labels and comments on PRs over the limit.
25+
Finish or close one before you open another.
26+
- Work on one `.po` file per branch and pull request, as the README's steps do.
27+
- Reserve a file before translating it,
28+
with the "Rezervasyon" issue template (`.github/ISSUE_TEMPLATE/file_reservation.md`).
29+
Do not translate a file someone else has reserved.
30+
- Entries flagged `#, fuzzy` are not used in the build.
31+
Remove the flag only after you have checked and updated the translation.
32+
33+
## Translation rules
34+
35+
- Keep role and link targets in English, or the Sphinx build fails
36+
(`i18n.inconsistent_references`).
37+
- Roles: translate only the shown text,
38+
e.g. `` :term:`dosya nesnesi <file object>` ``.
39+
A bare `` :func:`len` `` stays as it is.
40+
- Named links: leave `` `Documentation bugs`_ `` untouched.
41+
- Keep reST markup, code samples, literals (` ``...`` `), and placeholders
42+
(`%s`, `{name}`) exactly as in the `msgid`.
43+
- Use the term already used elsewhere in the repository.
44+
For example `string` is `dize`, not `metin`.
45+
Search existing `msgstr` entries with `rg` before choosing a term.
46+
- Write correct Turkish spelling, checked against the
47+
[TDK dictionary](https://sozluk.gov.tr/).
48+
49+
## Commands
50+
51+
Set up:
52+
53+
```sh
54+
python -m pip install --upgrade -r requirements-dev.txt
55+
pre-commit install
56+
```
57+
58+
Before committing a `.po` file:
59+
60+
```sh
61+
powrap path/to/file.po # rewrap to the project's line width
62+
pre-commit run --files path/to/file.po
63+
```
64+
65+
Build the HTML docs locally (clones CPython into `venv/cpython`):
66+
67+
```sh
68+
make
69+
```
70+
71+
Other `Makefile` targets: `make todo` (progress), `make fuzzy`, `make verifs`.
72+
73+
## Layout
74+
75+
- `*.po`, `<section>/*.po`: translations, laid out like CPython's `Doc/`.
76+
- `merge.py`: pulls new strings from CPython into the `.po` files.
77+
- `scripts/`: helper scripts (`format_check.py`, `progress.py`, `translate.py`).
78+
- `.github/workflows/`: CI, monthly CPython sync, rewrap, and the PR limit check.
79+
- `TRANSLATORS`: contributor credits.

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Bu proje gönüllü çevirmenler ve python-docs-tr ekibi iş birliğinde sürdü
6161

6262
1. TRANSLATORS dosyasına isminizi ekleyin. (Çeviri kabul edilirse yaptığınız katkı için övgü toplayabilirsiniz.)
6363
2. GitHub üzerinden çevirilerinizi göndermek için ``3.15`` branch'ine bir pull request oluşturun.
64+
- Aynı anda en fazla **3** açık pull request'iniz olabilir. Daha fazlasını açarsanız pull request'iniz ``too-many-prs`` etiketiyle işaretlenir. Yeni bir pull request açmadan önce açık olanlardan birinin birleştirilmesini ya da kapatılmasını bekleyin.
6465
3. Çevirilerinizin kabul edilmesini bekleyin.
6566
- Bu süreçte çevirileriniz, uygunluğunu ve yazım hatalarını değerlendirmek için birkaç kişi tarafından incelenecektir.
6667
- İncelemenin sonucunda bazı değişiklikler yapmanız istenebilir.

0 commit comments

Comments
 (0)