-
Notifications
You must be signed in to change notification settings - Fork 147
108 lines (87 loc) · 2.64 KB
/
UpdateReadme.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
name: Update README
on:
push:
branches:
- main
- master
paths:
- 'participants/**/*.yml'
- 'update_readme.py'
schedule:
- cron: '0 0 1 1 *'
workflow_dispatch:
jobs:
ValidateYAML:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Validate YAML files
uses: SoftCreatR/[email protected]
ValidateLinks:
runs-on: ubuntu-latest
needs: [ValidateYAML]
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Set up Ruby 2.6
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- id: file-diff
uses: lots0logs/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Validate Links
run: |
FILELIST=""
for FILENAME in $(jq '.[]' $HOME/files.json); do
FILENAME="${FILENAME:1}"
FILENAME="${FILENAME::-1}"
if [ -f "$FILENAME" ] && [[ $FILENAME == *"participants"* ]] && [ "${FILENAME: -4}" == ".yml" ]; then
FILELIST+="$FILENAME,"
else
echo "- Skipped $FILENAME"
fi
done
if [ -n "$FILELIST" ]; then
gem install awesome_bot
awesome_bot --files "$FILELIST" --allow-dupe --allow-redirect --skip-save-results
else
echo "Nothing to do."
fi
Main:
runs-on: ubuntu-latest
needs: [ValidateYAML, ValidateLinks]
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: python -m pip install -r requirements.txt
- name: Update README
run: python update_readme.py
- name: Commit and push on changes
run: |-
git add .
git diff
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git commit -m "Updated README" -a || echo "No changes to commit"
git push
UpdateContributors:
runs-on: ubuntu-latest
needs: [ValidateYAML, ValidateLinks, Main]
steps:
- name: Git checkout
uses: actions/checkout@v3
- uses: BobAnkh/[email protected]
with:
REPO_NAME: 'benbarth/hacktoberfest-swag'
CONTRIBUTOR: '## Contributors ✨'
ACCESS_TOKEN: ${{secrets.GITHUB_TOKEN}}
IGNORED_CONTRIBUTORS: 'Ben Barth,Sascha Greuel,Chandler Weiner'