Skip to content

feat: add workflow to auto-label translation PRs - #749

Merged
flpm merged 2 commits into
pyOpenSci:mainfrom
wahajmasood:feat/label-translation-prs
Jul 29, 2026
Merged

feat: add workflow to auto-label translation PRs#749
flpm merged 2 commits into
pyOpenSci:mainfrom
wahajmasood:feat/label-translation-prs

Conversation

@wahajmasood

Copy link
Copy Markdown
Contributor

Adds .github/workflows/label-translations.yml which listens for pull_request_target events touching locales/**/*.po and applies:

  • the generic 'translations' label
  • a per-language 'lang-XX' label extracted from each locales/XX/... path, uppercased to match the existing lang-ES / lang-JA / lang-PT labels

Handles multi-language PRs by applying each detected 'lang-XX'. Skips PRs that do not touch any .po file under locales/.

Uses pull_request_target so it can add labels on PRs from forks, with least-privilege permissions (pull-requests: write, contents: read) and without checking out or executing PR code.

Closes #702

Adds .github/workflows/label-translations.yml which listens for
pull_request_target events touching locales/**/*.po and applies:

- the generic 'translations' label
- a per-language 'lang-XX' label extracted from each locales/XX/... path,
  uppercased to match the existing lang-ES / lang-JA / lang-PT labels

Handles multi-language PRs by applying each detected 'lang-XX'. Skips PRs
that do not touch any .po file under locales/.

Uses pull_request_target so it can add labels on PRs from forks, with
least-privilege permissions (pull-requests: write, contents: read) and
without checking out or executing PR code.

Closes pyOpenSci#702
@wahajmasood

Copy link
Copy Markdown
Contributor Author

Hi @lwasser friendly nudge on this one whenever you have a spare moment. CI is green and it's mergeable; happy to iterate on anything in review. No rush. Thanks!

@flpm

flpm commented Jul 29, 2026

Copy link
Copy Markdown
Member

I can take a look today @wahajmasood !

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Not ready to approve

The workflow’s permissions don’t grant issues: write needed for issues.addLabels, so labeling will fail at runtime.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

Adds a GitHub Actions workflow to automatically label PRs that modify translation .po files under locales/**, supporting both a general translations label and per-language lang-XX labels derived from the locale path.

Changes:

  • Introduces a pull_request_target workflow scoped to locales/**/*.po changes.
  • Detects language codes from changed file paths and applies translations + lang-XX labels (multi-language aware).
File summaries
File Description
.github/workflows/label-translations.yml New workflow that detects changed locales/**.po files and applies translation-related labels to the PR.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Low

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment thread .github/workflows/label-translations.yml
@flpm

flpm commented Jul 29, 2026

Copy link
Copy Markdown
Member

@all-contributors please add @wahajmasood for code

@allcontributors

Copy link
Copy Markdown
Contributor

@flpm

I've put up a pull request to add @wahajmasood! 🎉

@flpm flpm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM thanks @wahajmasood This will save us some time!!

@flpm
flpm merged commit 35c6a2d into pyOpenSci:main Jul 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: create a github action that tags a pr that modifies a po file as "translations

3 participants