-
Notifications
You must be signed in to change notification settings - Fork 34
35 lines (34 loc) · 1.35 KB
/
update_readme.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
name: update readme
on:
schedule:
- cron: '0 12 * * 0'
run-name: update readme
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{secrets.PAT}}
ref: main
- name: Update README
run: |
date=$(date +%Y%m%d --date='last sunday')
url="https://s3.ap-southeast-1.amazonaws.com/snapshot.mantle.xyz/$date-mainnet-chaindata.tar.zst"
url_us="https://s3.amazonaws.com/snapshot-us.mantle.xyz/$date-mainnet-chaindata.tar.zst"
echo $(date)
curl -I -L --fail --silent --show-error --output /dev/null "$url" && curl -I -L --fail --silent --show-error --output /dev/null ${url_us}
if [ $? -eq 0 ]
then
current_time=$(grep -Eo '[0-9]{8}' run-node-mainnetv2.md |head -n1)
sed -i "s/${current_time}/$date/g" run-node-mainnetv2.md
sed -i "s/${current_time}/$date/g" run-node-sepolia.md
git config --global user.email "[email protected]"
git config --global user.name "mantle-github-bot"
git add run-node-mainnetv2.md run-node-sepolia.md
git commit -m "update snapshot tar date"
git push https://mantle-github-bot:${{ secrets.PAT }}@github.com/mantlenetworkio/networks.git main
else
echo "file do not exit"
fi