{"id":25171821,"url":"https://github.com/basemax/autoinvitetoorgbyissuecomment","last_synced_at":"2025-05-05T21:15:23.950Z","repository":{"id":38272970,"uuid":"378427717","full_name":"BaseMax/AutoInviteToOrgByIssueComment","owner":"BaseMax","description":"Auto Join:  A GitHub action script to automatically invite everyone to the organization who comment at the issue page. ","archived":false,"fork":false,"pushed_at":"2022-06-08T03:48:17.000Z","size":36,"stargazers_count":6,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-05T21:15:13.364Z","etag":null,"topics":["auto-join","auto-join-github","auto-join-org","auto-join-orginization","auto-joiner","github","github-action","github-actions","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BaseMax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-19T14:10:07.000Z","updated_at":"2025-01-17T13:52:56.000Z","dependencies_parsed_at":"2022-08-18T06:10:40.697Z","dependency_job_id":null,"html_url":"https://github.com/BaseMax/AutoInviteToOrgByIssueComment","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FAutoInviteToOrgByIssueComment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FAutoInviteToOrgByIssueComment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FAutoInviteToOrgByIssueComment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FAutoInviteToOrgByIssueComment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BaseMax","download_url":"https://codeload.github.com/BaseMax/AutoInviteToOrgByIssueComment/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252577026,"owners_count":21770721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auto-join","auto-join-github","auto-join-org","auto-join-orginization","auto-joiner","github","github-action","github-actions","python","python3"],"created_at":"2025-02-09T09:22:13.298Z","updated_at":"2025-05-05T21:15:23.936Z","avatar_url":"https://github.com/BaseMax.png","language":"Python","readme":"# Auto Invite To Org By Issue Comment\n\nA GitHub action script to automatically invite everyone to the organization who comment at the issue page.\n\n## What is this?\n\nSTART, FORK this.\n\nNext You can write `.invite me` at [here](https://github.com/BaseMax/AutoInviteToOrgByIssueComment/issues/1\n), after that you will be invited to a surprising and fantastic organization.\n\n----------\n\n## Deploy to your organization\n\n#### Create `MY_GITHUB_KEY` variable at Secrets\n\nOpen https://github.com/settings/tokens and create one.\n\nAfter that you can create a secret at `https://github.com/ORG_NAME/REPO_NAME/settings/secrets/actions`.\n\n#### Create `COMMUNITY_TEAM_ID` variable at Secrets\n\nAt first, create a team at `https://github.com/orgs/YOUR_ORG_NAME/teams` and run:\n\n\n```\ncurl -H \"Authorization: token *****\" https://api.github.com/orgs/YOUR_ORG_NAME/teams\n```\n\np.s: Put your personal token at the `****`, and replace your organization name at `YOUR_ORG_NAME`.\n\nAfter that you can create a secret at `https://github.com/ORG_NAME/REPO_NAME/settings/secrets/actions` and put api number as value.\n\n#### Create `.github/workflows/invite-by-comment.yml` file:\n\n```yaml\non:\n  issue_comment:\n    types: [created, edited]\nname: Invite a new user by comment\njobs:\n    build:\n      runs-on: ubuntu-latest\n\n      steps:\n        - name: checkout repo content\n          uses: actions/checkout@v2\n        - name: setup python\n          uses: actions/setup-python@v2\n          with:\n            python-version: 3.8\n        - name: Install dependencies\n          run: |\n            python -m pip install --upgrade pip\n            pip install requests\n            if [ -f ./.github/workflows/requirements.txt ]; then pip install -r ./.github/workflows/requirements.txt; fi\n        - name: execute py script\n          run: |\n            python ./.github/workflows/AutoInviteToOrgByIssueComment.py\n          env:\n            MY_GITHUB_KEY: ${{ secrets.MY_GITHUB_KEY }}\n            COMMUNITY_TEAM_ID: ${{ secrets.COMMUNITY_TEAM_ID }}\n```\n\n### Create `.github/workflows/AutoInviteToOrgByIssueComment.py` file\n\n```python\n# Max Base\n# 2021-06-19\n# https://github.com/BaseMax/AutoInviteToOrgByIssueComment\n\nimport os\nimport sys\nimport json\nimport requests\n\nprint(\"Hello, World\")\n\nif os.getenv('CI'):\n    print('Looks like GitHub!')\nelse:\n    print('Maybe running locally?')\n\nprint(\"Environ:\")\nprint(os.environ)\nprint(\"Prefix:\")\nprint(sys.prefix)\n\nMY_GITHUB_KEY = os.environ['MY_GITHUB_KEY']\nCOMMUNITY_TEAM_ID = os.environ['COMMUNITY_TEAM_ID']\n\nfile = open(os.environ['GITHUB_EVENT_PATH'])\ndata = json.load(file)\n\nprint(\"Data:\")\nprint(data)\n\nCOMMENT = data[\"comment\"][\"body\"]\nUSERNAME = data[\"comment\"][\"user\"][\"login\"]\n\nif \".invite @\" not in COMMENT and \".invite me\" not in COMMENT:\n  sys.exit()\nelse:\n\n  if \".invite @\" in COMMENT\n    USERNAME = COMMENT.replace(\".invite @\", \"\")\n\n  print('Send invite for the @'+USERNAME)\n\n  # TODO: check user already joined or no....\n  url = 'https://api.github.com/teams/'+COMMUNITY_TEAM_ID+'/memberships/' + USERNAME\n  payload=''\n  headers = {\n      'Accept': 'application/vnd.github.v3+json',\n      'Authorization': 'token '+MY_GITHUB_KEY\n  }\n  response = requests.request(\"PUT\", url, headers=headers, data=payload)\n  print(response.text)\n```\n\n© Copyright Max Base, 2021\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fautoinvitetoorgbyissuecomment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasemax%2Fautoinvitetoorgbyissuecomment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fautoinvitetoorgbyissuecomment/lists"}