mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-02-01 22:48:03 +00:00
91 lines
3.7 KiB
YAML
91 lines
3.7 KiB
YAML
name: '🏷️ PR Contribution Guidelines Notifier'
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- 'opened'
|
|
|
|
jobs:
|
|
notify-process-change:
|
|
runs-on: 'ubuntu-latest'
|
|
if: |-
|
|
github.repository == 'google-gemini/gemini-cli' || github.repository == 'google-gemini/maintainers-gemini-cli'
|
|
permissions:
|
|
pull-requests: 'write'
|
|
steps:
|
|
- name: 'Generate GitHub App Token'
|
|
id: 'generate_token'
|
|
env:
|
|
APP_ID: '${{ secrets.APP_ID }}'
|
|
if: |-
|
|
${{ env.APP_ID != '' }}
|
|
uses: 'actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b' # ratchet:actions/create-github-app-token@v2
|
|
with:
|
|
app-id: '${{ secrets.APP_ID }}'
|
|
private-key: '${{ secrets.PRIVATE_KEY }}'
|
|
|
|
- name: 'Check membership and post comment'
|
|
uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea'
|
|
with:
|
|
github-token: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
|
|
script: |-
|
|
const org = context.repo.owner;
|
|
const repo = context.repo.repo;
|
|
const username = context.payload.pull_request.user.login;
|
|
const pr_number = context.payload.pull_request.number;
|
|
const team_slug = 'gemini-cli-maintainers';
|
|
|
|
// 1. Check if the PR author is a maintainer
|
|
try {
|
|
await github.rest.teams.getMembershipForUserInOrg({
|
|
org,
|
|
team_slug,
|
|
username,
|
|
});
|
|
core.info(`${username} is a maintainer. No notification needed.`);
|
|
return;
|
|
} catch (error) {
|
|
if (error.status !== 404) throw error;
|
|
}
|
|
|
|
// 2. Check if the PR is already associated with an issue
|
|
const query = `
|
|
query($owner:String!, $repo:String!, $number:Int!) {
|
|
repository(owner:$owner, name:$repo) {
|
|
pullRequest(number:$number) {
|
|
closingIssuesReferences(first: 1) {
|
|
totalCount
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
const variables = { owner: org, repo: repo, number: pr_number };
|
|
const result = await github.graphql(query, variables);
|
|
const issueCount = result.repository.pullRequest.closingIssuesReferences.totalCount;
|
|
|
|
if (issueCount > 0) {
|
|
core.info(`PR #${pr_number} is already associated with an issue. No notification needed.`);
|
|
return;
|
|
}
|
|
|
|
// 3. Post the notification comment
|
|
core.info(`${username} is not a maintainer and PR #${pr_number} has no linked issue. Posting notification.`);
|
|
|
|
const comment = `
|
|
Hi @${username}, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this.
|
|
|
|
We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: [Improving Our Contribution Process & Introducing New Guidelines](https://github.com/google-gemini/gemini-cli/discussions/16706).
|
|
|
|
Key Update: Starting **January 26, 2026**, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed.
|
|
|
|
Thank you for your understanding and for being a part of our community!
|
|
`.trim().replace(/^[ ]+/gm, '');
|
|
|
|
await github.rest.issues.createComment({
|
|
owner: org,
|
|
repo: repo,
|
|
issue_number: pr_number,
|
|
body: comment
|
|
});
|