-
Notifications
You must be signed in to change notification settings - Fork 1.2k
45 lines (36 loc) · 1.16 KB
/
maintain-gh-pages.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
name: 🐙 Update gh-pages site
on:
workflow_dispatch: # Manual dispatch
push:
branches: [ master ]
paths: ['CHECKLIST.md']
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Configure git
run: |
git config --global user.email "[email protected]"
git config --global user.name "Liss.Bot"
- name: Copy CHECKLIST.md to gh-pages
run: |
# Fetch all branches
git fetch --all
# Switch to gh-pages branch
git checkout gh-pages
# Copy CHECKLIST from master branch
git checkout master -- CHECKLIST.md
# Move and rename CHECKLIST.md to the root
mv CHECKLIST.md README.md
# Check if there are changes, if so commit and push
if [ -n "$(git status --porcelain)" ]; then
git add README.md
git commit -m "Update README.md from master branch"
git push origin gh-pages
else
echo "No changes in README.md"
fi