Skip to content

sync chatGPT site

sync chatGPT site #228

Workflow file for this run

name: "sync chatGPT site"
on:
workflow_dispatch:
schedule:
- cron: '0 1 * * 0'
jobs:
sync:
runs-on: ubuntu-latest
if: github.repository == 'xiaoxuan6/chatgpt-server'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: setup python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: sync
env:
URL: ${{ secrets.URL }}
run: |
python -m pip install --upgrade pip
pip install -r ./requirements.txt
data="$(python main.py --url=$URL)"
echo "urls=$data" >> $GITHUB_ENV
echo "urls: $data"
working-directory: .github/python
- name: Check if URLs environment variable is empty
run: |
urls=${{ env.urls }}
echo "urls: $urls"
if [ -z "$urls" ]; then
echo "URLs environment variable is empty. Exiting workflow."
exit 1
fi
- name: replace js
run:
data=${{ env.urls }} && sed -i "s|data = .*;|data = '$data';|g" ./js/index.js
- name: "Commit files"
run: |
git config --local user.email "[email protected]"
git config --local user.name "xiaoxuan6"
git add -A
git commit -m "fix: Update index.js" || exit 0
- name: "Push changes"
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true