-
Notifications
You must be signed in to change notification settings - Fork 1.1k
59 lines (48 loc) · 1.91 KB
/
contribution_approved.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Contribution Approved
on:
issues:
types: ["labeled"]
concurrency: add_internships
jobs:
run-python-script:
runs-on: ubuntu-latest
if: github.event.label.name == 'approved'
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.9"
- name: execute contribution_approved.py
id: python_script
env:
GITHUB_EVENT_PATH: ${{ github.event_path }}
run: python .github/scripts/contribution_approved.py $GITHUB_EVENT_PATH
- name: execute update_readmes.py
id: python_script_readme
run: python .github/scripts/update_readmes.py
- name: commit files
if: success()
run: |
git config --local user.email ${{ steps.python_script.outputs.commit_email }}
git config --local user.name ${{ steps.python_script.outputs.commit_username }}
git add .github/scripts/listings.json
git add README.md
git diff-index --quiet HEAD || (git commit -a -m "${{ steps.python_script.outputs.commit_message }}" --allow-empty)
- name: push changes
if: success()
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: dev
- name: Auto Close Issue
run: gh issue close --comment "Your contribution was accepted. Auto-closing issue" ${{ github.event.issue.number }}
if: success()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Problem With Action
run: gh issue comment ${{ github.event.issue.number }} --body "There was an error with our github action. Error - ${{ steps.python_script.outputs.error_message }} ${{ steps.python_script_readme.outputs.error_message }}"
if: failure()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}