Automatically invite users to your repository via GitHub Issues. No more manual adding—just open an issue with a keyword and get invited instantly.
Speak, friend, and enter
When someone opens an issue with the keyword "invite me" (or "Invite me"), this workflow:
- ✅ Sends them a collaborator invitation
- 📧 Posts a confirmation comment
- 🔒 Closes the issue automatically
Perfect for educational projects.
- Go to your GitHub profile → Settings → Developer settings → Personal access tokens → Fine-grained tokens
- Click Generate new token
- Give it a name (e.g., "Invite Students Token")
- Under Repository access, select your repository
- Under Permissions, set:
- Administration: Read and Write (needed to invite collaborators)
- Issues: Read and Write (needed to comment and close issues)
- Click Generate token and copy it immediately
- Go to your repository → Settings → Secrets and variables → Actions
- Click New repository secret
- Name:
INVITE_TOKEN - Paste your token into the Secret field
- Click Add secret
- Add the workflow file to
.github/workflows/auto-invite.ymlin your repository - Anyone can now open an issue with the title containing "invite me"
- They'll automatically get invited with push permissions and receive a notification
Edit the condition in the workflow file:
if: contains(github.event.issue.title, 'your custom keyword') || contains(github.event.issue.title, 'Your Custom Keyword')Place this in .github/workflows/auto-invite.yml:
name: Auto Invite Collaborator
on:
issues:
types: [opened, edited]
jobs:
invite:
runs-on: ubuntu-latest
if: contains(github.event.issue.title, 'invite me') || contains(github.event.issue.title, 'Invite me')
steps:
- name: Invite User via GitHub CLI
run: |
gh api \
--method PUT \
-H "Accept: application/vnd.github+json" \
/repos/${{ github.repository }}/collaborators/${{ github.event.issue.user.login }} \
-f permission='push'
env:
GH_TOKEN: ${{ secrets.INVITE_TOKEN }}
- name: Close the issue with a comment
run: |
gh issue comment ${{ github.event.issue.number }} --body "Hi @${{ github.event.issue.user.login }}! 👋 An invitation has been sent to your GitHub account and email. Please check your notifications or email to accept it and start collaborating!"
gh issue close ${{ github.event.issue.number }}
env:
GH_TOKEN: ${{ secrets.INVITE_TOKEN }}- check if issue could be deleted (instead of closed) to keep passphrase "secret"
- The fine-grained token is scoped to only this repository
- Grants permissions for administration, so be careful, there'll be 🐉
MIT