-
Notifications
You must be signed in to change notification settings - Fork 0
/
dl_and_push.sh
executable file
·59 lines (46 loc) · 1.26 KB
/
dl_and_push.sh
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
#!/bin/bash
# Hard-coded Feishu document URL
FEISHU_URL="https://ndro4zkb6p.feishu.cn/docx/FaBXdERDvoleXDxSiMXcMBegnvd"
# Extract the document ID from the URL
DOC_ID=$(basename "$FEISHU_URL")
# Download the document using feishu2md
echo "Downloading document..."
feishu2md dl "$FEISHU_URL"
# Check if the download was successful
if [ $? -ne 0 ]; then
echo "Failed to download the document."
exit 1
fi
# Rename the downloaded file to README.md
echo "Renaming the downloaded file..."
mv "${DOC_ID}.md" "README.md"
# Check if the rename was successful
if [ $? -ne 0 ]; then
echo "Failed to rename the file."
exit 1
fi
# Add the file to the Git staging area
echo "Adding file to Git..."
git add .
# Check if the add was successful
if [ $? -ne 0 ]; then
echo "Failed to add the file to Git."
exit 1
fi
# Commit the changes with a message
echo "Committing changes..."
git commit -m 'add paper'
# Check if the commit was successful
if [ $? -ne 0 ]; then
echo "Failed to commit the changes."
exit 1
fi
# Push the changes to the remote repository
echo "Pushing changes to remote repository..."
git push
# Check if the push was successful
if [ $? -ne 0 ]; then
echo "Failed to push the changes."
exit 1
fi
echo "Process completed successfully."