WIKI_BOT #22358
This file contains hidden or 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
| name: WIKI_BOT | |
| # Controls when the workflow will run | |
| on: | |
| # # Triggers the workflow on push or pull request events but only for the main branch | |
| # push: | |
| # branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| schedule: | |
| - cron: '17 */2 * * *' | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| main: | |
| runs-on: ubuntu-latest | |
| env: | |
| OD_USERNAME: 'oni-zh-cn@outlook.com' | |
| steps: | |
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.8' | |
| architecture: 'x64' | |
| - name: Python dependences cache | |
| uses: actions/cache@v4 | |
| if: startsWith(runner.os, 'Linux') | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements_temp.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install Python requirements | |
| run: | | |
| python -m pip install --upgrade pip | |
| test -f requirements.txt && pip install -r requirements.txt | |
| - name: MS credential cache | |
| id: restore-ms-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ImgHost/ms_cache.bin.gpg | |
| key: ms-cache-${{ secrets.MS_CACHE_VERSION }} | |
| - name: Decrypt MS credential Cache | |
| if: steps.restore-ms-cache.outputs.cache-hit == 'true' | |
| run: gpg -d --batch -o ImgHost/ms_cache.bin --passphrase ${{ secrets.MS_SECRET }} ImgHost/ms_cache.bin.gpg | |
| - env: | |
| BOT_NAME: ${{ secrets.BOT_NAME }} | |
| BOT_PASS: ${{ secrets.BOT_PASS_2 }} | |
| MS_CLIENT_ID: ${{secrets.MS_CLIENT_ID}} | |
| MS_SECRET: ${{secrets.MS_SECRET}} | |
| RC_IN_SECONDS: 86400 | |
| run: python -u ./main.py | |
| - name: Encrypt MS credential Cache | |
| if: steps.restore-ms-cache.outputs.cache-hit != 'true' | |
| run: | | |
| # ls -lah ImgHost | |
| touch ImgHost/ms_cache.bin && gpg -c --batch --passphrase ${{ secrets.MS_SECRET }} ImgHost/ms_cache.bin |