-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (35 loc) · 992 Bytes
/
move-main.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
name: Move doc/main.pdf to root
on:
push:
branches:
- doc
- main
permissions:
contents: write
jobs:
move-pdf-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Move PDF if exists
run: |
if [ -f doc/main.pdf ]; then
mv doc/main.pdf main.pdf
else
echo "doc/main.pdf does not exist, skipping move step."
fi
- name: Set up Git
run: |
git config user.email "[email protected]"
git config user.name "GitHub Actions"
base_branch=$(echo "${GITHUB_REF#refs/heads/}")
- name: Commit and push changes
run: |
if git diff-index --quiet HEAD; then
echo "No changes to commit, skipping commit and push."
else
git add --all
git commit -m "Move main.pdf to root folder"
git push origin $base_branch
fi