Flush All PDF #431
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: Flush All PDF | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * 0" # auto flush pdf on sunday | |
| jobs: | |
| flush-pdf: | |
| name: Flush PDF | |
| runs-on: ubuntu-latest | |
| env: | |
| TENCENTCLOUD_SECRET_ID: ${{ secrets.TENCENTCLOUD_SECRET_ID }} | |
| TENCENTCLOUD_SECRET_KEY: ${{ secrets.TENCENTCLOUD_SECRET_KEY }} | |
| steps: | |
| - name: Set up Python environment | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| architecture: 'x64' | |
| - name: Install Tencent Cloud CLI | |
| run: pip3 install tccli | |
| - name: Download PDF list | |
| run: | | |
| curl https://raw.githubusercontent.com/pingcap/docs-cn/master/resources/cdnfresh.txt --output cdnfresh.txt | |
| cat cdnfresh.txt | |
| - name: Refresh URLs | |
| run: | | |
| cat cdnfresh.txt | jq -nR '[inputs | select(length>0)]' | tee cdnfresh.json | |
| tccli cdn PurgeUrlsCache --Urls "$(cat cdnfresh.json)" | tee result.json | |
| task_id="$(cat result.json | jq .TaskId)" | |
| if [ -z "${task_id}" ]; then | |
| echo "Unable to find TaskId, CDN refresh might fail" | |
| exit 1 | |
| fi |