Skip to content

Commit

Permalink
Compatible to run on Windows platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
grbnb committed Nov 12, 2024
1 parent 6083513 commit 45073a0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
fetch-depth: 2

- name: Random Cron
uses: grbnb/random-workflow-cron@dev
uses: grbnb/random-workflow-cron@v1
with:
keep_history: true
```
Expand All @@ -54,22 +54,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
repository: ${{ github.repository }}
ref: dev
fetch-depth: 2
- name: Random Cron
uses: grbnb/random-workflow-cron@dev
uses: grbnb/random-workflow-cron@v1
with:
workflow_name: ".github/workflows/ci.yml"
ref_branch: dev
keep_history: true
```

Set the random hour range to `1-21` [UTC+8 time zone], running only 5 times a day every 15 days, but not immediately pushing and commit to the repository. This means that there are push operations in the steps after the workflow file, avoiding multiple push operations!!!
Set the random hour range to `1-21` [UTC+8 time zone], running only 7 times a day every 15 days, but not immediately pushing and commit to the repository. This means that there are push operations in the steps after the workflow file, avoiding multiple push operations!!!

```yml
name: 'random-cron'
Expand All @@ -84,12 +84,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
- name: Random Cron
uses: grbnb/random-workflow-cron@dev
uses: grbnb/random-workflow-cron@v1
with:
push_switch: false
time_zone: "UTC+8"
Expand Down Expand Up @@ -145,7 +145,7 @@ Error: Invalid exit code: 128
Add GitHub API `token` key to your workflow yml file at `uses: actions/checkout@v3` in step
```yml
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
fetch-depth: 2
Expand Down
16 changes: 8 additions & 8 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
fetch-depth: 2

- name: Random Cron
uses: grbnb/random-workflow-cron@dev
uses: grbnb/random-workflow-cron@v1
with:
github_token: ${{ secrets.PAT }}
keep_history: true
Expand All @@ -55,23 +55,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
repository: ${{ github.repository }}
ref: dev
fetch-depth: 2
- name: Random Cron
uses: grbnb/random-workflow-cron@dev
uses: grbnb/random-workflow-cron@v1
with:
workflow_name: ".github/workflows/ci.yml"
github_token: ${{ secrets.PAT }}
ref_branch: dev
keep_history: true
```

设置随机小时范围为`1-21`[UTC+8时区],每间隔15天并且一天只运行5次, 但是不立即推送提交到仓库,即工作流文件后面的步骤存在推送操作,避免多次推送!!!
设置随机小时范围为`1-21`[UTC+8时区],每间隔15天并且一天只运行7次, 但是不立即推送提交到仓库,即工作流文件后面的步骤存在推送操作,避免多次推送!!!

```yml
name: 'random-cron'
Expand All @@ -86,12 +86,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
- name: Random Cron
uses: grbnb/random-workflow-cron@dev
uses: grbnb/random-workflow-cron@v1
with:
push_switch: false
time_zone: "UTC+8"
Expand Down Expand Up @@ -147,7 +147,7 @@ Error: Invalid exit code: 128
添加GitHub API `token`密钥到工作流yml文件的`uses:actions/checkout@v3`步骤中
```yml
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
fetch-depth: 2
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ runs:
using: 'composite'
steps:
- shell: bash
run: bash ${{ github.action_path }}/cron.sh
run: bash "${{ github.action_path }}/cron.sh"
env:
workflow_name: ${{ inputs.workflow_name }}
push_switch: ${{ inputs.push_switch }}
Expand Down

0 comments on commit 45073a0

Please sign in to comment.