Skip to content

Commit fe8e4f8

Browse files
authored
Update invitation.yml
1 parent b03af81 commit fe8e4f8

File tree

1 file changed

+55
-4
lines changed

1 file changed

+55
-4
lines changed

.github/workflows/invitation.yml

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,68 @@
1+
name: Automate Invitation
2+
13
on:
24
issues:
35
types: [labeled]
46

57
jobs:
6-
automate_invite:
8+
handle_label:
79
runs-on: ubuntu-latest
10+
811
steps:
9-
- name: Invite on label
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: Create Issue in Support Repository
21+
id: create_issue
22+
if: ${{ steps.check_label.outcome == 'success' }}
23+
uses: actions/github-script@v5
24+
with:
25+
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
26+
script: |
27+
const issue = context.payload.issue;
28+
const { owner, repo } = context.repo;
29+
const response = await github.rest.issues.create({
30+
owner: 'Recode-Hive',
31+
repo: 'Support',
32+
title: issue.title,
33+
body: issue.body,
34+
labels: ['invite me to the community'],
35+
});
36+
core.setOutput('issue_number', response.data.number);
37+
38+
- name: Close Original Issue in StackOverflow Repository
39+
if: ${{ steps.check_label.outcome == 'success' }}
40+
uses: actions/github-script@v5
41+
with:
42+
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
43+
script: |
44+
const issue = context.payload.issue;
45+
await github.rest.issues.update({
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
issue_number: issue.number,
49+
state: 'closed'
50+
});
51+
52+
- name: Invite on Label
53+
if: ${{ steps.check_label.outcome == 'success' }}
1054
uses: vj-abigo/[email protected]
1155
with:
1256
organization: Recode-Hive
1357
label: invite me to the community
14-
repo-token: ${{ secrets.GITHUB_TOKEN }}
15-
comment: "<b>Invitation sent to join the GitHub Organisation. Welcome to the community 🎉</b><br><br>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/Recode-Hive/people<br><br>"
58+
repo-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
59+
comment: |
60+
<b>Invitation sent to join the GitHub Organisation. Welcome to the community 🎉</b><br><br>
61+
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/Recode-Hive/people<br><br>
62+
Tips for practising:<br><br>
63+
Customise your GitHub profile, here is a course on that: https://www.udemy.com/course/make-your-github-profile-stand-out/<br>
64+
Practice repo, instructions on how to add your name to the README https://github.com/Recode-Hive/hacktoberfest-practice<br>
65+
Remember contributing to open source is not just about code, it's about collaboration, communication and adding value<br>
66+
I hope that helps
1667
env:
1768
INVITE_TOKEN: ${{ secrets.INVITE_TOKEN }}

0 commit comments

Comments
 (0)