-
Notifications
You must be signed in to change notification settings - Fork 3
59 lines (51 loc) · 1.53 KB
/
update_readme.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: Update Readme
on:
pull_request:
types: [closed]
jobs:
run-script:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r script/requirements.txt
- name: Check token
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
if [ -z "$ACCESS_TOKEN" ]; then
echo "TOKEN is not set"
else
echo "TOKEN is set"
fi
- name: Run python script
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
working-directory: ./script
run: python collector.py
- name: Check for changes in README.md
id: check_changes
run: |
if git diff --exit-code README.md; then
echo "no changes"
echo "changes=false" >> $GITHUB_ENV
else
echo "Changes detected"
echo "changes=true" >> $GITHUB_ENV
fi
- name: Commit and push changes
if: env.changes == 'true'
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add README.md
git commit -m "Update README.md"
git push