JamesIves/github-pages-deploy-action

Action succeeds even when push fails

rossjrw opened this issue · 1 comments

Errors as a result of git push are currently ignored:

const pushResult = await execute(
`git push --porcelain ${action.repositoryPath} ${temporaryDeploymentBranch}:${action.branch}`,
`${action.workspace}/${temporaryDeploymentDirectory}`,
action.silent,
true // Ignore non-zero exit status
)

There's a check that looks for strings like '[rejected]' in the output, but these aren't guaranteed to appear. E.g. when authentication fails, the error string starts with 'fatal:' instead. It would be more robust to fail the script if an error is detected and the string match also failed - in this case, repeating the attempted push several times probably won't ever work anyway.

See the following workflow log where this error happened and was ignored, resulting in the job succeeding while the deployment did not actually succeed: https://github.com/www-learn-study/saraswati.learn.study/actions/runs/6727951896/job/18286524048, section 'Deploy preview'

This issue appears to have been introduced with #1054.

This has been resolved in the next version where a check for fatal: occurs on every line as opposed to just the first.