update refresh_token #1124
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#更新refresh_token | |
name: update refresh_token | |
on: | |
release: | |
types: [published] | |
# push: | |
# tags: | |
# - 'v*' | |
# branches: | |
# - main | |
schedule: | |
- cron: "0 */12 * * *" | |
watch: | |
types: [started] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Set up Python #安装python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.10.15 | |
- name: Install requests #安装requests | |
run: | | |
pip install requests | |
pip install pytz | |
- name: Read config from secrets #读取机密 | |
env: | |
CONFIG_ID: ${{ secrets.CONFIG_ID }} # secrets_id 提供 | |
CONFIG_KEY: ${{ secrets.CONFIG_KEY }} # secrets_key 提供 | |
run: | | |
cp update.py update2.py | |
echo $CONFIG_ID > configid.txt | |
echo $CONFIG_KEY > configkey.txt | |
sed -i '14 r configid.txt' update2.py | |
sed -i '16 r configkey.txt' update2.py | |
- name: Update token #更新token | |
run: | | |
python update2.py | |
- name: Delete secrets config #删除机密 | |
run: | | |
rm -f update2.py | |
rm -f configid.txt | |
rm -f configkey.txt | |
- name: Commit #上传新的refresh_token到仓库 | |
run: | | |
git config --global user.email [email protected] | |
git config --global user.name donxan | |
git add . | |
git commit -m "update new refresh_token" -a | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |