更新工作流,减少对下游影响

更新工作流,减少对下游影响
This commit is contained in:
CC康纳百川 2024-09-05 00:01:34 +08:00 committed by GitHub
parent b353474237
commit aba4aa3b13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,33 +14,79 @@ jobs:
steps: steps:
- name: Pull Latest Repository - name: Pull Latest Repository
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python - name: Install Python
uses: actions/setup-python@v4 uses: actions/setup-python@v5
with: with:
python-version: '3.x' python-version: '3.12'
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
- name: Download last_articles.json artifact
uses: dawidd6/action-download-artifact@v6
with:
github_token: ${{secrets.GITHUB_TOKEN}}
branch: main
name: 'last_articles'
path: './rss_subscribe'
if_no_artifact_found: warn
- name: Check RSS feeds - name: Check RSS feeds
env: env:
SMTP_PWD: ${{ secrets.SMTP_PWD }} SMTP_PWD: ${{ secrets.SMTP_PWD }}
run: | run: |
python run.py python run.py
- name: Upload last_articles.json as artifact
uses: actions/upload-artifact@v4
with:
name: 'last_articles'
path: './rss_subscribe/last_articles.json'
retention-days: 90
- name: git config - name: git config
run: | run: |
git config --global user.name 'GitHub Actions' git config --global user.name 'github-actions[bot]'
git config --global user.email 'actions@github.com' git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Commit changes - name: Commit changes
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
run: | run: |
mkdir pages
cp -r main index.html all.json errors.json pages/
cd pages
git init
git add . git add .
git commit -m "⏱GitHub Action定时更新" git commit -m "⏱️ $(date +"%Z %Y-%m-%d %A %H:%M:%S") Updated By GitHub Actions"
git push https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository }}.git main git push --force https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:gh-pages
- name: Delete Workflow Runs
uses: Mattraks/delete-workflow-runs@v2
with:
retain_days: 90
keep_minimum_runs: 6
keepalive-workflow:
name: Keepalive Workflow
if: ${{ always() }}
needs: friend-circle-lite
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: actions/checkout@v4
- uses: gautamkrishnar/keepalive-workflow@v2
with:
committer_username: "github-actions[bot]"
committer_email: "github-actions[bot]@users.noreply.github.com"