Skip to content

Commit

Permalink
ci: [Phil + Weijun] Create GitHub Actions workflow to allow users to …
Browse files Browse the repository at this point in the history
…self-assign issues (paradedb#1691)

Signed-off-by: Philippe Noël <[email protected]>
Co-authored-by: Weijun-H <[email protected]>
  • Loading branch information
philippemnoel and Weijun-H authored Sep 20, 2024
1 parent 728acdd commit ad8692f
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 2 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/assign-github-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# workflows/assign-github-issue.yml
#
# Assign GitHub Issue
# Automatically assign an issue to the commenter if they use the '/take' command.

name: Assign GitHub Issue

on:
issue_comment:
types: [created]

# Required to assign the issue to the commenter
permissions:
issues: write

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

jobs:
assign-github-issue:
name: Assign GitHub Issue to Commenter
runs-on: depot-ubuntu-latest-2
if: !github.event.issue.pull_request && contains(github.event.comment.body, '/take')

steps:
- name: Check if Commenter Can Be Assigned
id: check_assignee
run: |
HTTP_CODE=$(curl -X GET \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-o /dev/null -w '%{http_code}\n' -s \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees/${{ github.event.comment.user.login }}")
if [ "$HTTP_CODE" -eq "204" ]; then
echo "can_assign=true" >> $GITHUB_OUTPUT
else
echo "can_assign=false" >> $GITHUB_OUTPUT
fi
- name: Assign GitHub Issue
if: steps.check_assignee.outputs.can_assign == 'true'
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '{"assignees": ["${{ github.event.comment.user.login }}"]}' \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees"
echo "Issue #${{ github.event.issue.number }} assigned to ${{ github.event.comment.user.login }}"
- name: Notify of Assignment Failure
if: steps.check_assignee.outputs.can_assign == 'false'
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.name,
body: '@${{ github.event.comment.user.login }} Unable to assign this issue to you. You may not have the necessary permissions.'
})
18 changes: 16 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# **Contributing to ParadeDB**

Welcome! We're excited that you're interested in contributing to ParadeDB and want
to make the process as smooth as possible.
Welcome! We're excited that you're interested in contributing to ParadeDB and want to make the process as smooth as possible.

## Technical Info

Expand All @@ -10,6 +9,21 @@ conventions to follow when submitting changes. If you have any questions not cov
in this document, please reach out to us in the [ParadeDB Community Slack](https://join.slack.com/t/paradedbcommunity/shared_invite/zt-2lkzdsetw-OiIgbyFeiibd1DG~6wFgTQ)
or via [email](mailto:[email protected]).

### Claiming GitHub Issues

This repository has a workflow to automatically assign issues to new contributors. This ensures that you don't need approval
from a maintainer to pick an issue.

1. Before claiming an issue, ensure that:

- It's not already assigned to someone else
- There are no comments indicating ongoing work

2. To claim an unassigned issue, simply comment `/take` on the issue. This will automatically assign the issue to you.

If you find yourself unable to make progress, don't hesitate to seek help in the issue comments or in the [ParadeDB Community Slack](https://join.slack.com/t/paradedbcommunity/shared_invite/zt-2lkzdsetw-OiIgbyFeiibd1DG~6wFgTQ). If you no longer wish to
work on the issue(s) you self-assigned, please use the `unassign me` link at the top of the issue(s) page to release it.

### Development Workflow

ParadeDB is structured as a monorepo containing our Postgres extensions, our Docker setup, and our development tools for benchmarking and testing.
Expand Down

0 comments on commit ad8692f

Please sign in to comment.