|
| 1 | +name: Automate Invitation |
| 2 | + |
1 | 3 | on:
|
2 | 4 | issues:
|
3 | 5 | types: [labeled]
|
4 | 6 |
|
5 | 7 | jobs:
|
6 |
| - automate_invite: |
| 8 | + handle_label: |
7 | 9 | runs-on: ubuntu-latest
|
| 10 | + |
8 | 11 | 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' }} |
10 | 54 |
|
11 | 55 | with:
|
12 | 56 | organization: Recode-Hive
|
13 | 57 | 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 |
16 | 67 | env:
|
17 | 68 | INVITE_TOKEN: ${{ secrets.INVITE_TOKEN }}
|
0 commit comments