-
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.
- Loading branch information
0 parents
commit 26786fe
Showing
4 changed files
with
91 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,46 @@ | ||
import os | ||
import sys | ||
import json | ||
import requests | ||
|
||
if os.getenv('CI'): | ||
print('Looks like GitHub!') | ||
else: | ||
print('Maybe running locally?') | ||
|
||
print("Environ:") | ||
print(os.environ) | ||
print("Prefix:") | ||
print(sys.prefix) | ||
|
||
MY_GITHUB_KEY = os.environ['MY_GITHUB_KEY'] | ||
COMMUNITY_TEAM_ID = os.environ['COMMUNITY_TEAM_ID'] | ||
|
||
file = open(os.environ['GITHUB_EVENT_PATH']) | ||
data = json.load(file) | ||
|
||
print("Data:") | ||
print(data) | ||
|
||
COMMENT = data["comment"]["body"] | ||
USERNAME = data["comment"]["user"]["login"] | ||
|
||
if "am i kyute ? @" not in COMMENT and "am i kyute ?" not in COMMENT: | ||
sys.exit() | ||
else: | ||
|
||
if "am i kyute ? @" in COMMENT: | ||
USERNAME = COMMENT.replace("am i kyute ? @", "") | ||
|
||
print('Send invite for the @'+USERNAME) | ||
|
||
# TODO: check user already joined or no.... | ||
url = 'https://api.github.com/teams/' + \ | ||
COMMUNITY_TEAM_ID+'/memberships/' + USERNAME | ||
payload = '' | ||
headers = { | ||
'Accept': 'application/vnd.github.v3+json', | ||
'Authorization': 'token '+MY_GITHUB_KEY | ||
} | ||
response = requests.request("PUT", url, headers=headers, data=payload) | ||
print(response.text) |
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,26 @@ | ||
on: | ||
issue_comment: | ||
types: [created, edited] | ||
name: Sending Invitation To The Recent Commenter | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: checkout repo content | ||
uses: actions/checkout@v2 | ||
- name: setup python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install requests | ||
if [ -f ./.github/workflows/requirements.txt ]; then pip install -r ./.github/workflows/requirements.txt; fi | ||
- name: execute py script | ||
run: | | ||
python ./.github/workflows/AutoInviteToOrgByIssueComment.py | ||
env: | ||
MY_GITHUB_KEY: ${{ secrets.MY_GITHUB_KEY }} | ||
COMMUNITY_TEAM_ID: ${{ secrets.COMMUNITY_TEAM_ID }} |
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,2 @@ | ||
/node_modules | ||
.vscode |
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,17 @@ | ||
### ๐ **Automated Organization Joining Invitation** | ||
|
||
Greetings! ๐ | ||
|
||
We're excited to invite you to become a part of our vibrant community at KyuteFox! ๐ฆโจ. | ||
|
||
Your journey with us begins with a simple step: leaving a comment on the designated issue. | ||
|
||
Drop by [THIS ISSUE](https://github.com/kyutefox/join-kyutefox/issues/1) and playfully ask, `am i kyute ?` | ||
|
||
We're eagerly awaiting your response! | ||
|
||
By the time check your Email for the Invitation link. We can't wait to welcome you aboard! | ||
|
||
Best Regards, | ||
|
||
The KyuteFox Team ๐๐ |