diff --git a/README.md b/README.md index e5cb22f..2e88986 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,21 @@ If your workflow is slow, the bottleneck is usually network waiting on RSS endpo > Example worst-case per feed: with `request_timeout: 30` and `retry_count: 5`, one feed can wait up to ~`210s` (3.5 minutes) before failing. +### Troubleshooting: `Unexpected input(s)` warnings + +If your workflow logs show: + +```text +Warning: Unexpected input(s) 'request_timeout', 'push_retry_count' +``` + +that means the action reference in your workflow does not include these newer inputs yet. + +- Update your `uses:` reference to a newer ref that includes `request_timeout` and `push_retry_count` in `action.yml`. +- If you must stay on an older ref, remove these two keys from `with:` to avoid warnings. + +You can always check support by opening the `action.yml` file at the exact ref you are using and confirming the input names. + ## Advanced usage examples Click to expand: diff --git a/dist/blog-post-workflow.js b/dist/blog-post-workflow.js index 309906d..bedd278 100644 --- a/dist/blog-post-workflow.js +++ b/dist/blog-post-workflow.js @@ -30656,6 +30656,7 @@ var commitReadme = async (githubToken, readmeFilePaths) => { const committerEmail = getInput("committer_email"); const commitMessage = getInput("commit_message"); const pushRetryCount = Number.parseInt(getInput("push_retry_count"), 10) || 3; + const pushRetryWaitTime = Number.parseInt(getInput("retry_wait_time"), 10) || 1; const branchName = process.env.GITHUB_REF_NAME || process.env.GITHUB_HEAD_REF || "main"; await exec("git", ["config", "--global", "user.email", committerEmail]); if (githubToken) { @@ -30672,7 +30673,7 @@ var commitReadme = async (githubToken, readmeFilePaths) => { let pushTry = 0; while (pushTry <= pushRetryCount) { try { - await exec("git", ["push"]); + await exec("git", ["push", "origin", `HEAD:${branchName}`]); info("Readme updated successfully in the upstream repository"); return; } catch (err) { @@ -30681,9 +30682,13 @@ var commitReadme = async (githubToken, readmeFilePaths) => { throw err; } warning( - `git push failed (attempt ${pushTry}/${pushRetryCount}). Pulling latest changes and retrying...` + `git push failed (attempt ${pushTry}/${pushRetryCount}). Rebasing on latest remote changes and retrying in ${pushRetryWaitTime}s...` + ); + await exec("git", ["fetch", "origin", branchName]); + await exec("git", ["rebase", `origin/${branchName}`]); + await new Promise( + (resolve) => setTimeout(resolve, pushRetryWaitTime * 1e3) ); - await exec("git", ["pull", "--rebase", "origin", branchName]); } } info("Readme updated successfully in the upstream repository"); diff --git a/src/utils.js b/src/utils.js index bba6941..9377f62 100644 --- a/src/utils.js +++ b/src/utils.js @@ -105,6 +105,8 @@ const commitReadme = async (githubToken, readmeFilePaths) => { const commitMessage = core.getInput('commit_message'); const pushRetryCount = Number.parseInt(core.getInput('push_retry_count'), 10) || 3; + const pushRetryWaitTime = + Number.parseInt(core.getInput('retry_wait_time'), 10) || 1; const branchName = process.env.GITHUB_REF_NAME || process.env.GITHUB_HEAD_REF || 'main'; // Doing commit and push @@ -124,7 +126,7 @@ const commitReadme = async (githubToken, readmeFilePaths) => { let pushTry = 0; while (pushTry <= pushRetryCount) { try { - await exec('git', ['push']); + await exec('git', ['push', 'origin', `HEAD:${branchName}`]); core.info('Readme updated successfully in the upstream repository'); return; } catch (err) { @@ -133,9 +135,13 @@ const commitReadme = async (githubToken, readmeFilePaths) => { throw err; } core.warning( - `git push failed (attempt ${pushTry}/${pushRetryCount}). Pulling latest changes and retrying...`, + `git push failed (attempt ${pushTry}/${pushRetryCount}). Rebasing on latest remote changes and retrying in ${pushRetryWaitTime}s...`, + ); + await exec('git', ['fetch', 'origin', branchName]); + await exec('git', ['rebase', `origin/${branchName}`]); + await new Promise((resolve) => + setTimeout(resolve, pushRetryWaitTime * 1000), ); - await exec('git', ['pull', '--rebase', 'origin', branchName]); } } core.info('Readme updated successfully in the upstream repository');