Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
on:
issue_comment:
types: [created]

permissions:
issues: write
models: read

jobs:
auto-assign:
runs-on: ubuntu-latest
steps:
- name: Check if requesting assignment
uses: actions/ai-inference@v1
id: check-request
with:
prompt: |
Does this comment ask to be assigned to the issue?
Respond with only "yes" or "no".

Comment: ${{ github.event.comment.body }}
model: openai/gpt-4o-mini
temperature: 0.1

- name: Handle assignment
if: steps.check-request.outputs.response == 'yes'
uses: actions/github-script@v7
with:
script: |
Copy link
Member

Choose a reason for hiding this comment

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

Sorry: do we first check whether the issue is assigned already? Sometimes a volunteer asks to be assigned to an issue that has already be assigned to someone else a few hours ago. In such cases we kindly ask them to find another bug and give them the issue search link found in the Welcome page. It would be fantastic to automate that. 🙂

// Get all open issues assigned to the commenter
const assignedIssues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
assignee: context.actor,
state: 'open'
});
// Get all open PRs created by the commenter
const pullRequests = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
creator: context.actor,
state: 'open'
});
// No assigned issues - assign
if (assignedIssues.data.length === 0) {
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
assignees: [context.actor]
});
}
// Has assigned issues but no PRs: ask them to finish first
else if (assignedIssues.data.length > 0 && pullRequests.data.length === 0) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: "Please finish your previous assignment before you request to work on another"
});
}
// Has assigned issues with PRs: assign them
else {
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
assignees: [context.actor]
});
}
46 changes: 46 additions & 0 deletions .github/workflows/pull_request_unrelated_changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Check Pull Request Scope

on:
pull_request:
types: [opened, synchronize]

permissions:
pull-requests: write
models: read

jobs:
check-scope:
runs-on: ubuntu-latest
steps:
# Use AI to detect if pull request mixes unrelated changes
- name: Analyse pull request changes
uses: actions/ai-inference@v1
id: analyze
with:
prompt: |
Analyse this pull request to determine if it contains unrelated changes.
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.

Examples of changes that are not acceptable:
* Fixing indentation or formatting in unrelated files or in unrelated parts of a file.
* Adding or removing unrelated comments.

Pull Request Title: ${{ github.event.pull_request.title }}
Pull Request Description: ${{ github.event.pull_request.body }}

Does this pull request appear to mix unrelated changes? Respond with only "yes" or "no".
model: openai/gpt-4o-mini
temperature: 0.1

# If unrelated changes detected, remind contributor of guidelines
- name: Comment if unrelated changes detected
if: steps.analyze.outputs.response == 'yes'
uses: actions/github-script@v7
with:
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
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."
});
24 changes: 24 additions & 0 deletions .github/workflows/suggest_duplicate_bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Detect duplicate issues

on:
issues:
types: [opened, reopened]

permissions:
models: read
issues: write

concurrency:
group: ${{ github.workflow }}-${{ github.event.issue.number }}
cancel-in-progress: true

jobs:
continuous-triage-dedup:
if: ${{ github.event.issue.user.type != 'Bot' }}
runs-on: ubuntu-latest
steps:
- uses: pelikhan/action-genai-issue-dedup@v0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Optional tuning:
# labels: "auto" # compare within matching labels, or "bug,api"
42 changes: 42 additions & 0 deletions .github/workflows/welcome_new_contributors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Welcome New Contributors

on:
pull_request:
types: [opened]

permissions:
pull-requests: write
models: read

jobs:
welcome:
runs-on: ubuntu-latest
if: github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
steps:
- name: Generate welcome message
uses: actions/ai-inference@v1
id: ai
with:
prompt: |
Write a friendly welcome message for a first-time contributor. Include:
1. Thank them for their first PR
2. Mention checking CONTRIBUTING.md
3. Explain that after fixing 5 bugs, they can work on enhancements
Copy link
Collaborator

Choose a reason for hiding this comment

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

@nicolas-raoul Should this be "Features" instead of enhancements, as we migrated all the issues with label: enhancement to type: Feature ?

Copy link
Member

Choose a reason for hiding this comment

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

Great point @Kota-Jagadeesh !

"feature" is a bit more ambiguous than "enhancement" so I would suggest the wording "adding features".

By the way, the same probably applies to our documentation too. 🙂

Copy link
Collaborator

Choose a reason for hiding this comment

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

Great point @Kota-Jagadeesh !

"feature" is a bit more ambiguous than "enhancement" so I would suggest the wording "adding features".

By the way, the same probably applies to our documentation too. 🙂

Yep, will fix the documentation :)

4. Link to the welcome document: https://github.com/commons-app/commons-app-documentation/blob/master/android/Volunteers-welcome!.md
5. Offer to help if they have questions

Keep it brief and encouraging.
model: openai/gpt-4o-mini
temperature: 0.7

- name: Post welcome comment
uses: actions/github-script@v7
with:
script: |
const message = `${{ steps.ai.outputs.response }}`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ github.event.pull_request.number }},
body: message
});