Skip to content

Commit 60591c4

Browse files
Merge branch 'main' into fix/external-upload-limit
2 parents da0578d + c7ee60f commit 60591c4

File tree

4 files changed

+198
-0
lines changed

4 files changed

+198
-0
lines changed

.github/workflows/auto_assign.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
on:
2+
issue_comment:
3+
types: [created]
4+
5+
permissions:
6+
issues: write
7+
models: read
8+
9+
jobs:
10+
auto-assign:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check if requesting assignment
14+
uses: actions/ai-inference@v1
15+
id: check-request
16+
with:
17+
prompt: |
18+
Does this comment ask to be assigned to the issue?
19+
Respond with only "yes" or "no".
20+
21+
Comment: ${{ github.event.comment.body }}
22+
model: openai/gpt-4o-mini
23+
24+
- name: Handle assignment
25+
if: steps.check-request.outputs.response == 'yes'
26+
uses: actions/github-script@v7
27+
with:
28+
script: |
29+
// Check if the issue is already assigned
30+
const issue = await github.rest.issues.get({
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
issue_number: context.issue.number
34+
});
35+
36+
if (issue.data.assignees.length > 0) {
37+
// Issue is already assigned to someone else
38+
await github.rest.issues.createComment({
39+
owner: context.repo.owner,
40+
repo: context.repo.repo,
41+
issue_number: context.issue.number,
42+
body: "This issue has already been assigned. Please find another issue to work on: https://github.com/commons-app/apps-android-commons/issues?q=is%3Aissue%20state%3Aopen%20type%3ABug%20no%3Aassignee%20-label%3A%22low%20priority%22%20-label%3Adebated%20-label%3Aupstream"
43+
});
44+
return;
45+
}
46+
47+
// Check commenter's existing assignments
48+
const assignedIssues = await github.rest.issues.listForRepo({
49+
owner: context.repo.owner,
50+
repo: context.repo.repo,
51+
assignee: context.actor,
52+
state: 'open'
53+
});
54+
55+
const pullRequests = await github.rest.pulls.list({
56+
owner: context.repo.owner,
57+
repo: context.repo.repo,
58+
creator: context.actor,
59+
state: 'open'
60+
});
61+
62+
// No assigned issues - safe to assign
63+
if (assignedIssues.data.length === 0) {
64+
await github.rest.issues.addAssignees({
65+
owner: context.repo.owner,
66+
repo: context.repo.repo,
67+
issue_number: context.issue.number,
68+
assignees: [context.actor]
69+
});
70+
}
71+
// Has assigned issues but no PRs - ask them to finish first
72+
else if (assignedIssues.data.length > 0 && pullRequests.data.length === 0) {
73+
await github.rest.issues.createComment({
74+
owner: context.repo.owner,
75+
repo: context.repo.repo,
76+
issue_number: context.issue.number,
77+
body: "Please finish your previous assignment before you request to work on another"
78+
});
79+
}
80+
// Has assigned issues WITH PRs - they're making progress, assign them
81+
else {
82+
await github.rest.issues.addAssignees({
83+
owner: context.repo.owner,
84+
repo: context.repo.repo,
85+
issue_number: context.issue.number,
86+
assignees: [context.actor]
87+
});
88+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Check Pull Request Scope
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
7+
permissions:
8+
pull-requests: write
9+
models: read
10+
11+
jobs:
12+
check-scope:
13+
runs-on: ubuntu-latest
14+
steps:
15+
# Use AI to detect if pull request mixes unrelated changes
16+
- name: Analyse pull request changes
17+
uses: actions/ai-inference@v1
18+
id: analyze
19+
with:
20+
prompt: |
21+
Analyse this pull request to determine if it contains unrelated changes.
22+
A pull request should modify only the code that really needs to be modified to solve the issue at hand. Changes unrelated to the issue at hand can be made in other pull requests.
23+
24+
Examples of changes that are not acceptable:
25+
* Fixing indentation or formatting in unrelated files or in unrelated parts of a file.
26+
* Adding or removing unrelated comments.
27+
28+
Pull Request Title: ${{ github.event.pull_request.title }}
29+
Pull Request Description: ${{ github.event.pull_request.body }}
30+
31+
Does this pull request appear to mix unrelated changes? Respond with only "yes" or "no".
32+
model: openai/gpt-4o-mini
33+
34+
# If unrelated changes detected, remind contributor of guidelines
35+
- name: Comment if unrelated changes detected
36+
if: steps.analyze.outputs.response == 'yes'
37+
uses: actions/github-script@v7
38+
with:
39+
script: |
40+
await github.rest.issues.createComment({
41+
owner: context.repo.owner,
42+
repo: context.repo.repo,
43+
issue_number: context.issue.number,
44+
body: "This pull request appears to contain unrelated changes. A pull request should modify only the code that really needs to be modified to solve the issue at hand. Please review [CONTRIBUTING.md](https://github.com/commons-app/apps-android-commons/blob/master/CONTRIBUTING.md) and consider splitting this into separate pull requests."
45+
});
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Detect duplicate issues
2+
3+
on:
4+
issues:
5+
types: [opened, reopened]
6+
7+
permissions:
8+
models: read
9+
issues: write
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.issue.number }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
continuous-triage-dedup:
17+
if: ${{ github.event.issue.user.type != 'Bot' }}
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: pelikhan/action-genai-issue-dedup@v0
21+
with:
22+
github_token: ${{ secrets.GITHUB_TOKEN }}
23+
# Optional tuning:
24+
# labels: "auto" # compare within matching labels, or "bug,api"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Welcome New Contributors
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
7+
permissions:
8+
pull-requests: write
9+
models: read
10+
11+
jobs:
12+
welcome:
13+
runs-on: ubuntu-latest
14+
if: github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
15+
steps:
16+
- name: Generate welcome message
17+
uses: actions/ai-inference@v1
18+
id: ai
19+
with:
20+
prompt: |
21+
Write a friendly welcome message for a first-time contributor. Include:
22+
1. Thank them for their first PR
23+
2. Mention checking CONTRIBUTING.md
24+
3. Explain that after fixing 5 bugs, they can work on adding features
25+
4. Link to the welcome document: https://github.com/commons-app/commons-app-documentation/blob/master/android/Volunteers-welcome!.md
26+
5. Offer to help if they have questions
27+
28+
Keep it brief and encouraging.
29+
model: openai/gpt-4o-mini
30+
31+
- name: Post welcome comment
32+
uses: actions/github-script@v7
33+
with:
34+
script: |
35+
const message = `${{ steps.ai.outputs.response }}`;
36+
await github.rest.issues.createComment({
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
issue_number: ${{ github.event.pull_request.number }},
40+
body: message
41+
});

0 commit comments

Comments
 (0)