Skip to content

Commit c5b3296

Browse files
authored
Create invite.yml
1 parent 0fce1f4 commit c5b3296

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

.github/workflows/invite.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Automate Invitation
2+
3+
on:
4+
issues:
5+
types: [labeled]
6+
7+
jobs:
8+
handle_label:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Check if Label is 'invite me to the community'
13+
id: check_label
14+
run: |
15+
if [[ "${{ github.event.label.name }}" != "invite me to the community" ]]; then
16+
echo "Label is not 'invite me to the community'. Exiting."
17+
exit 0
18+
fi
19+
20+
- name: Close Original Issue in Support Repository
21+
if: ${{ steps.check_label.outcome == 'success' }}
22+
uses: actions/github-script@v5
23+
with:
24+
github-token: ${{ secrets.INVITE_TOKEN }}
25+
script: |
26+
const issue = context.payload.issue;
27+
await github.rest.issues.update({
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
issue_number: issue.number,
31+
state: 'closed'
32+
});
33+
34+
- name: Invite on Label
35+
if: ${{ steps.check_label.outcome == 'success' }}
36+
uses: vj-abigo/invite-on-label@v1.2
37+
with:
38+
organization: Open-Hub-Community
39+
label: invite me to the community
40+
repo-token: ${{ secrets.INVITE_TOKEN }}
41+
comment: |
42+
<b>Invitation sent to join the GitHub Organisation. Welcome to the community 🎉</b><br><br>
43+
Don't forget after accepting to make it public so it appears on your GitHub profile for everyone else to see. You can do this by finding your name in the GitHub organisation list and change the dropdown to public https://github.com/orgs/Open-Hub-Community/people<br><br>
44+
env:
45+
INVITE_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}

0 commit comments

Comments
 (0)