'GitHub Actions Failed to Deploy changes to Heroku
I am using GitHub Actions to Deploy my JavaScript to Heroku and it is working fine as expected. However, when my GitHub Repository is recently updated my GitHub Actions failed stating the following. I have never updated the Heroku Git Manually, how can this issue happen?
Run AkhileshNS/[email protected]
Created and wrote to ~/.netrc
Successfully logged into heroku
› Warning: Our terms of service have changed:
› https://dashboard.heroku.com/terms-of-service
Added git remote heroku
remote: Compressing source files... done.
remote: Building source:
remote:
remote:
To https://git.heroku.com/wordleforvk.git
! [remote rejected] HEAD -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/wordleforvk.git'
Unable to push branch because the branch is behind the deployed branch. Using --force to deploy branch.
(If you want to avoid this, set dontuseforce to 1 in with: of .github/workflows/action.yml.
Specifically, the error was: Error: Command failed: git push heroku HEAD:refs/heads/main
remote: Compressing source files... done.
remote: Building source:
remote:
remote:
To https://git.heroku.com/wordleforvk.git
! [remote rejected] HEAD -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/wordleforvk.git'
Solution 1:[1]
tl;dr; You need to regenerate your Heroku API key and update it in your GitHub repo.
Heroku suffered a security incident earlier this year. They have since begun reseting all of their users' passwords which in turn invalidated the API access token you may have created. This is likely the reason for the error you are seeing.
To fix this:
- Use either the command link or the Heroku site to generate a new API key.
- Update your API key in your GitHub repository by going to
Settings
->Secrets
->Actions
and updating theHEROKU_API_KEY
. - Optional: You may also need to reenable automatic deploys by going to your app on Heroku, clicking Deploy, and reenabling
Automatic deploys
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Tal Ater |