Join request: @cornel-pe #7
This file contains hidden or 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
| name: Invite User | |
| on: | |
| issues: | |
| types: [opened] | |
| jobs: | |
| invite: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.ORG_INVITE_TOKEN }} | |
| script: | | |
| const body = context.payload.issue.body; | |
| const username = body.split("\n").pop().trim().replace("@",""); | |
| console.log("Username:", username); | |
| const user = await github.rest.users.getByUsername({ | |
| username: username | |
| }); | |
| await github.rest.orgs.createInvitation({ | |
| org: context.repo.owner, | |
| invitee_id: user.data.id, | |
| role: "direct_member" | |
| }); |