Random Cron #3582
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
name: Random Cron | |
on: | |
workflow_run: | |
workflows: ["刷步数"] | |
types: | |
- completed | |
jobs: | |
repo-sync: | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
if: github.event.workflow_run.conclusion == 'success' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.PAT }} #此处PAT需要申请,教程详见:https://www.jianshu.com/p/bb82b3ad1d11,需要repo和workflow权限 | |
- name: random cron | |
run: | | |
sed -i -E "s/(- cron: ')[0-9]+( [^[:space:]]+ \* \* \*')/\1$(($RANDOM % 30))\2/g" .github/workflows/run.yml | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add . | |
git commit -m "random cron" | |
git push origin main |