8000 Enable take comments to assign issues to users (#1058) · satwikmishra11/datafusion-python@0002372 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0002372

Browse files
authored
Enable take comments to assign issues to users (apache#1058)
1 parent d72f560 commit 0002372

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/take.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Assign the issue via a `take` comment
19+
on:
20+
issue_comment:
21+
types: created
22+
23+
permissions:
24+
issues: write
25+
26+
jobs:
27+
issue_assign:
28+
runs-on: ubuntu-latest
29+
if: (!github.event.issue.pull_request) && github.event.comment.body == 'take'
30+
concurrency:
31+
group: ${{ github.actor }}-issue-assign
32+
steps:
33+
- run: |
34+
CODE=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -LI https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees/${{ github.event.comment.user.login }} -o /dev/null -w '%{http_code}\n' -s)
35+
if [ "$CODE" -eq "204" ]
36+
then
37+
echo "Assigning issue ${{ github.event.issue.number }} to ${{ github.event.comment.user.login }}"
38+
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{"assignees": ["${{ github.event.comment.user.login }}"]}' https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees
39+
else
40+
echo "Cannot assign issue ${{ github.event.issue.number }} to ${{ github.event.comment.user.login }}"
41+
fi

0 commit comments

Comments
 (0)
0