-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from GDSC-Hongik/chore/random-reviewer
Chore/random reviewer
- Loading branch information
Showing
7 changed files
with
363 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Include any files or directories that you don't want to be copied to your | ||
# container here (e.g., local build artifacts, temporary files, etc.). | ||
# | ||
# For more help, visit the .dockerignore file reference guide at | ||
# https://docs.docker.com/go/build-context-dockerignore/ | ||
|
||
**/.DS_Store | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.factorypath | ||
**/.git | ||
**/.gitignore | ||
**/.idea | ||
**/.project | ||
**/.sts4-cache | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/.next | ||
**/.cache | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/charts | ||
**/docker-compose* | ||
**/compose.y*ml | ||
**/Dockerfile* | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
**/vendor | ||
LICENSE | ||
README.md | ||
**/*.class | ||
**/*.iml | ||
**/*.ipr | ||
**/*.iws | ||
**/*.log | ||
**/.apt_generated | ||
**/.gradle | ||
**/.gradletasknamecache | ||
**/.nb-gradle | ||
**/.springBeans | ||
**/build | ||
**/dist | ||
**/gradle-app.setting | ||
**/nbbuild | ||
**/nbdist | ||
**/nbproject/private | ||
**/target | ||
*.ctxt | ||
.mtj.tmp | ||
.mvn/timing.properties | ||
buildNumber.properties | ||
dependency-reduced-pom.xml | ||
hs_err_pid* | ||
pom.xml.next | ||
pom.xml.releaseBackup | ||
pom.xml.tag | ||
pom.xml.versionsBackup | ||
release.properties | ||
replay_pid* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "random_reviewer", | ||
"version": "1.0.0", | ||
"main": "reviewer.js", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@actions/core": "^1.11.1", | ||
"@actions/github": "^6.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
const core = require("@actions/core"); | ||
const github = require("@actions/github"); | ||
|
||
const member= { | ||
cmj7271: "740776211231277066", | ||
ybkang1108: "1038826581558296636", | ||
yeeunli: "1082157260249251870", | ||
JungJaehoon0430: "1007395745223151726" | ||
} | ||
|
||
function selectRandomReviewer() { | ||
const candidate = Object.keys(member).filter( | ||
(name) => name !== github.context.actor | ||
) | ||
return candidate[ | ||
Math.floor(Math.random() * candidate.length) | ||
] | ||
} | ||
|
||
async function sendDiscordMsg(reviewer) { | ||
const webhook = process.env.DISCORD_WEBHOOK; | ||
|
||
const msg = { | ||
content: createMsg(reviewer) | ||
} | ||
|
||
await fetch(webhook, { | ||
method: "POST", | ||
headers: { 'Content-type': 'application/json' }, | ||
body: JSON.stringify(msg) | ||
}) | ||
} | ||
|
||
function createMsg(reviewer) { | ||
return "리뷰해주세요\n" + "* PR: " + `https://github.com/${github.context.repo.owner}/${github.context.repo.repo}/pulls/${github.context.payload.pull_request.number}` | ||
+ "\n* 담당자: @" + "<@&" + member[reviewer] + ">" | ||
} | ||
|
||
async function main() { | ||
const githubClient = github.getOctokit(process.env.REVIEW_TOKEN); | ||
const reviewer = selectRandomReviewer(); | ||
|
||
githubClient.rest.pulls.requestReviewers( | ||
{ | ||
owner: github.context.repo.owner, | ||
repo: github.context.repo.repo, | ||
pull_number: github.context.payload.pull_request.number, | ||
reviewers: [reviewer] | ||
} | ||
) | ||
.then((res) => console.log("reviewer assign success: ", res)) | ||
.catch((err) => console.log("reviewer assign failed:", err)); | ||
|
||
sendDiscordMsg(reviewer) | ||
.then(() => console.log("message send success")) | ||
.catch(() => console.log("message send failed")); | ||
} | ||
|
||
main().then(() => console.log("success")).catch(() => console.log("failed")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
"@actions/core@^1.11.1": | ||
version "1.11.1" | ||
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.11.1.tgz#ae683aac5112438021588030efb53b1adb86f172" | ||
integrity sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A== | ||
dependencies: | ||
"@actions/exec" "^1.1.1" | ||
"@actions/http-client" "^2.0.1" | ||
|
||
"@actions/exec@^1.1.1": | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/@actions/exec/-/exec-1.1.1.tgz#2e43f28c54022537172819a7cf886c844221a611" | ||
integrity sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w== | ||
dependencies: | ||
"@actions/io" "^1.0.1" | ||
|
||
"@actions/github@^6.0.0": | ||
version "6.0.0" | ||
resolved "https://registry.yarnpkg.com/@actions/github/-/github-6.0.0.tgz#65883433f9d81521b782a64cc1fd45eef2191ea7" | ||
integrity sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g== | ||
dependencies: | ||
"@actions/http-client" "^2.2.0" | ||
"@octokit/core" "^5.0.1" | ||
"@octokit/plugin-paginate-rest" "^9.0.0" | ||
"@octokit/plugin-rest-endpoint-methods" "^10.0.0" | ||
|
||
"@actions/http-client@^2.0.1", "@actions/http-client@^2.2.0": | ||
version "2.2.3" | ||
resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-2.2.3.tgz#31fc0b25c0e665754ed39a9f19a8611fc6dab674" | ||
integrity sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA== | ||
dependencies: | ||
tunnel "^0.0.6" | ||
undici "^5.25.4" | ||
|
||
"@actions/io@^1.0.1": | ||
version "1.1.3" | ||
resolved "https://registry.yarnpkg.com/@actions/io/-/io-1.1.3.tgz#4cdb6254da7962b07473ff5c335f3da485d94d71" | ||
integrity sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q== | ||
|
||
"@fastify/busboy@^2.0.0": | ||
version "2.1.1" | ||
resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-2.1.1.tgz#b9da6a878a371829a0502c9b6c1c143ef6663f4d" | ||
integrity sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA== | ||
|
||
"@octokit/auth-token@^4.0.0": | ||
version "4.0.0" | ||
resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-4.0.0.tgz#40d203ea827b9f17f42a29c6afb93b7745ef80c7" | ||
integrity sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA== | ||
|
||
"@octokit/core@^5.0.1": | ||
version "5.2.0" | ||
resolved "https://registry.yarnpkg.com/@octokit/core/-/core-5.2.0.tgz#ddbeaefc6b44a39834e1bb2e58a49a117672a7ea" | ||
integrity sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg== | ||
dependencies: | ||
"@octokit/auth-token" "^4.0.0" | ||
"@octokit/graphql" "^7.1.0" | ||
"@octokit/request" "^8.3.1" | ||
"@octokit/request-error" "^5.1.0" | ||
"@octokit/types" "^13.0.0" | ||
before-after-hook "^2.2.0" | ||
universal-user-agent "^6.0.0" | ||
|
||
"@octokit/endpoint@^9.0.1": | ||
version "9.0.5" | ||
resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-9.0.5.tgz#e6c0ee684e307614c02fc6ac12274c50da465c44" | ||
integrity sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw== | ||
dependencies: | ||
"@octokit/types" "^13.1.0" | ||
universal-user-agent "^6.0.0" | ||
|
||
"@octokit/graphql@^7.1.0": | ||
version "7.1.0" | ||
resolved "https://registry.yarnpkg.com/@octokit/graphql/-/graphql-7.1.0.tgz#9bc1c5de92f026648131f04101cab949eeffe4e0" | ||
integrity sha512-r+oZUH7aMFui1ypZnAvZmn0KSqAUgE1/tUXIWaqUCa1758ts/Jio84GZuzsvUkme98kv0WFY8//n0J1Z+vsIsQ== | ||
dependencies: | ||
"@octokit/request" "^8.3.0" | ||
"@octokit/types" "^13.0.0" | ||
universal-user-agent "^6.0.0" | ||
|
||
"@octokit/openapi-types@^20.0.0": | ||
version "20.0.0" | ||
resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-20.0.0.tgz#9ec2daa0090eeb865ee147636e0c00f73790c6e5" | ||
integrity sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA== | ||
|
||
"@octokit/openapi-types@^22.2.0": | ||
version "22.2.0" | ||
resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-22.2.0.tgz#75aa7dcd440821d99def6a60b5f014207ae4968e" | ||
integrity sha512-QBhVjcUa9W7Wwhm6DBFu6ZZ+1/t/oYxqc2tp81Pi41YNuJinbFRx8B133qVOrAaBbF7D/m0Et6f9/pZt9Rc+tg== | ||
|
||
"@octokit/plugin-paginate-rest@^9.0.0": | ||
version "9.2.1" | ||
resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.1.tgz#2e2a2f0f52c9a4b1da1a3aa17dabe3c459b9e401" | ||
integrity sha512-wfGhE/TAkXZRLjksFXuDZdmGnJQHvtU/joFQdweXUgzo1XwvBCD4o4+75NtFfjfLK5IwLf9vHTfSiU3sLRYpRw== | ||
dependencies: | ||
"@octokit/types" "^12.6.0" | ||
|
||
"@octokit/plugin-rest-endpoint-methods@^10.0.0": | ||
version "10.4.1" | ||
resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz#41ba478a558b9f554793075b2e20cd2ef973be17" | ||
integrity sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg== | ||
dependencies: | ||
"@octokit/types" "^12.6.0" | ||
|
||
"@octokit/request-error@^5.1.0": | ||
version "5.1.0" | ||
resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-5.1.0.tgz#ee4138538d08c81a60be3f320cd71063064a3b30" | ||
integrity sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q== | ||
dependencies: | ||
"@octokit/types" "^13.1.0" | ||
deprecation "^2.0.0" | ||
once "^1.4.0" | ||
|
||
"@octokit/request@^8.3.0", "@octokit/request@^8.3.1": | ||
version "8.4.0" | ||
resolved "https://registry.yarnpkg.com/@octokit/request/-/request-8.4.0.tgz#7f4b7b1daa3d1f48c0977ad8fffa2c18adef8974" | ||
integrity sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw== | ||
dependencies: | ||
"@octokit/endpoint" "^9.0.1" | ||
"@octokit/request-error" "^5.1.0" | ||
"@octokit/types" "^13.1.0" | ||
universal-user-agent "^6.0.0" | ||
|
||
"@octokit/types@^12.6.0": | ||
version "12.6.0" | ||
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-12.6.0.tgz#8100fb9eeedfe083aae66473bd97b15b62aedcb2" | ||
integrity sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw== | ||
dependencies: | ||
"@octokit/openapi-types" "^20.0.0" | ||
|
||
"@octokit/types@^13.0.0", "@octokit/types@^13.1.0": | ||
version "13.6.2" | ||
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-13.6.2.tgz#e10fc4d2bdd65d836d1ced223b03ad4cfdb525bd" | ||
integrity sha512-WpbZfZUcZU77DrSW4wbsSgTPfKcp286q3ItaIgvSbBpZJlu6mnYXAkjZz6LVZPXkEvLIM8McanyZejKTYUHipA== | ||
dependencies: | ||
"@octokit/openapi-types" "^22.2.0" | ||
|
||
before-after-hook@^2.2.0: | ||
version "2.2.3" | ||
resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.3.tgz#c51e809c81a4e354084422b9b26bad88249c517c" | ||
integrity sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ== | ||
|
||
deprecation@^2.0.0: | ||
version "2.3.1" | ||
resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919" | ||
integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ== | ||
|
||
once@^1.4.0: | ||
version "1.4.0" | ||
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" | ||
integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== | ||
dependencies: | ||
wrappy "1" | ||
|
||
tunnel@^0.0.6: | ||
version "0.0.6" | ||
resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c" | ||
integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg== | ||
|
||
undici@^5.25.4: | ||
version "5.28.4" | ||
resolved "https://registry.yarnpkg.com/undici/-/undici-5.28.4.tgz#6b280408edb6a1a604a9b20340f45b422e373068" | ||
integrity sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g== | ||
dependencies: | ||
"@fastify/busboy" "^2.0.0" | ||
|
||
universal-user-agent@^6.0.0: | ||
version "6.0.1" | ||
resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-6.0.1.tgz#15f20f55da3c930c57bddbf1734c6654d5fd35aa" | ||
integrity sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ== | ||
|
||
wrappy@1: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" | ||
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: random-reviewer | ||
on: [pull_request] | ||
|
||
jobs: | ||
random-reviewer: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: install yarn | ||
run: npm install -g yarn | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20" | ||
cache: 'yarn' | ||
cache-dependency-path: .github/workflows/random_reviewer | ||
|
||
- name: install dependencies | ||
working-directory: .github/workflows/random_reviewer | ||
run: yarn install | ||
|
||
- name: run script | ||
working-directory: .github/workflows/random_reviewer | ||
run: node ./reviewer.js | ||
env: | ||
REVIEW_TOKEN: ${{ secrets.REVIEW_TOKEN }} | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM gradle:jdk17 AS bulider | ||
WORKDIR /builder | ||
|
||
COPY build.gradle settings.gradle gradlew /builder/ | ||
COPY ./gradle /builder/gradle | ||
|
||
RUN chmod +x gradlew | ||
RUN ./gradlew dependencies --no-daemon | ||
|
||
COPY ./src /builder/src | ||
RUN ./gradlew build --no-daemon | ||
|
||
FROM eclipse-temurin:17 | ||
WORKDIR /app | ||
|
||
COPY --from=bulider /builder/build/libs/*.jar app.jar | ||
|
||
ENTRYPOINT ["java", "-jar", "/app/app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
services: | ||
server: | ||
platform: linux/arm64 | ||
build: | ||
context: . | ||
ports: | ||
- 8080:8080 |