update workflow

Workflow will retry more 2 times before stop the workflow if github connection not stable
This commit is contained in:
siritami
2024-03-01 14:07:01 +07:00
parent ebe3fe1b26
commit ce939501ea
3 changed files with 86 additions and 13 deletions

24
.github/actions/re-run/action.yml vendored Normal file
View File

@@ -0,0 +1,24 @@
name: Re-run workflow if github connection not stable
runs:
using: "composite"
steps:
- name: Re-run workflow if github connection not stable
uses: actions/github-script@v7
with:
script: |
const maxRetries = ${{ env.max_retries }};
let retryCount = Number('${{ env.retry_count }}');
const orgInput = '${{ github.event.inputs.org }}' || '${{ inputs.org }}';
if (retryCount < maxRetries) {
retryCount += 1;
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: "manual-patch.yml",
ref: context.ref,
inputs: {
'retry_count': String(retryCount),
'org': orgInput
}
});
}