Skip to content

Commit

Permalink
๐ŸŽฎ Init
Browse files Browse the repository at this point in the history
  • Loading branch information
MrJukeman committed Aug 25, 2023
0 parents commit 26786fe
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/AutoInviteToOrgByIssueComment.py
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)
26 changes: 26 additions & 0 deletions .github/workflows/invite-by-comment.yml
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 }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
.vscode
17 changes: 17 additions & 0 deletions README.md
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 ๐Ÿš€๐ŸŽ‰

0 comments on commit 26786fe

Please sign in to comment.