-
Notifications
You must be signed in to change notification settings - Fork 8
52 lines (42 loc) · 1.32 KB
/
update.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
name: Update
on:
schedule:
- cron: "0 0 * * SUN"
workflow_dispatch:
permissions: write-all
jobs:
update:
name: Update the english book
runs-on: ubuntu-latest
outputs:
repo-updated: ${{ steps.git-step.outputs.updated }}
steps:
- uses: actions/checkout@v3
- name: Cleaning up the repository
run: |
DIR="./rustbook-en"
if [ -d "$DIR" ]; then
echo "Deleting ${DIR}..."
rm -rf ./rustbook-en
echo "Deleted ${DIR}..."
fi
- name: Clone the current state repo
uses: actions/checkout@v3
with:
repository: rust-lang/book
path: rustbook-en
- name: Remove git reference
run: |
# Delete the cloned data
sudo rm -rf ./rustbook-en/.git
- name: Setup git credentials
run: |
# Use github actions default username and email
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Push the content
run: |
git add .
[[ -z $(git status -uno --porcelain) ]] && echo "this branch is clean, no need to push..." && exit 0;
git commit -m "[BOT] Updating $GITHUB_SHA content"
git push origin main --force