8000 Merge pull request #68 from github/pr-welcome · github/CodeSearchNet@47cec95 · GitHub
[go: up one dir, main page]

Skip to content
8000
This repository was archived by the owner on Apr 11, 2023. It is now read-only.

Commit 47cec95

Browse files
author
Hamel Husain
authored
Merge pull request #68 from github/pr-welcome
Create pr.yaml
2 parents dbb2e64 + cab674f commit 47cec95

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/pr.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Benchmark Greeting
2+
on:
3+
pull_request:
4+
types: [opened]
5+
6+
# split into two jobs so it runs in parallel, even if a little redundant
7+
jobs:
8+
make_comment:
9+
if: contains(github.event.pull_request.body, 'This pull request represents a submission to the codesearchnet benchmark.')
10+
runs-on: ubuntu-latest
11+
steps:
12+
13+
- name: Greeting
14+
run: |
15+
URI=https://api.github.com
16+
API_VERSION=v3
17+
API_HEADER="Accept: application/vnd.github.${API_VERSION}+json"
18+
AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}"
19+
MESSAGE="@${USER} Thank you for your benchmark submission! Can you please tell us a little bit about your approach and how you trained your models etc? What modifications, if any, did you make on the baseline models provided in this repository? Thanks!"
20+
# Create a comment with APIv3 # POST /repos/:owner/:repo/issues/:issue_number/comments
21+
curl -XPOST -sSL \
22+
-d "{\"body\": \"$MESSAGE\"}" \
23+
-H "${AUTH_HEADER}" \
24+
-H "${API_HEADER}" \
25+
"${URI}/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments"
26+
env:
27+
USER: ${{ github.event.pull_request.user.login }}
28+
ISSUE_NUMBER: ${{ github.event.pull_request.number }}
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Choose Reviewer Randomly
32+
run: |
33+
import random
34+
reviewer = random.choice(['hamelsmu', 'hohsiangwu', 'mallamanis', 'mmjb'])
35+
print("::set-env name=REVIEWER::{}".format(reviewer))
36+
shell: python
37+
38+
- name: Assign Reviewer
39+
run: |
40+
URI=https://api.github.com
41+
API_VERSION=v3
42+
API_HEADER="Accept: application/vnd.github.${API_VERSION}+json"
43+
AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}"
44+
# Add assignee with APIv3 # POST /repos/:owner/:repo/pulls/:pull_number/requested_reviewers
45+
curl -XPOST -sSL \
46+
-d "{\"reviewers\": [\"${REVIEWER}\"]}" \
47+
-H "${AUTH_HEADER}" \
48+
-H "${API_HEADER}" \
49+
"${URI}/repos/${GITHUB_REPOSITORY}/pulls/${PULL_NUMBER}/requested_reviewers"
50+
env:
51+
PULL_NUMBER: ${{ github.event.pull_request.number }}
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)
0