随机定时运行 #3837
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: 随机定时运行 | |
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@v2 | |
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 % 10))\2/g" .github/workflows/run.yml | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add . | |
git commit -m "random cron." | |
git push origin master |