1
votes

I recently reached my Github monthly action limit and decided to use a self-host runner to deploy my app to a Heroku repo but I am getting a Heroku login error when running my workflow:

Run git remote add heroku ***git.heroku.com/$APP.git
fatal: remote heroku already exists.
remote: !   WARNING:
remote: !   Do not authenticate with username and password using git.
remote: !   Run `heroku login` to update your credentials, then retry the git command.
remote: !   See documentation for details: https://devcenter.heroku.com/articles/git#http-git-authentication
fatal: Authentication failed for 'https://git.heroku.com/.git/'
Error: Process completed with exit code 1.

Here is my build.yml workflow:

name: Node.js CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:

  deploy:
      
    runs-on: self-hosted
    
    steps:
      - name: Checkout Repo v2
        uses: actions/checkout@v2
      - run: git fetch --prune --unshallow
        
      - name: Deploying to Heroku
        env:
          TOKEN: ${{ secrets.HEROKU_TOKEN }}
          APP: ${{ secrets.HEROKU_APP }}
        run: |
          git remote add heroku https://heroku:[email protected]/$APP.git
          git push heroku HEAD:master -f

Where HEROKU_TOKEN and HEROKU_AAPP are github secrets.

This is my first time using self-hosted runners for workflows so I am a bit of a noob for troubleshooting errors. How do I fix this issue? Are there any bypasses?

Thanks in advance.

1

1 Answers

1
votes

For HEROKU_TOKEN, in Heroku, go to accounts settings and copy the API key. Then add it to secrets in GIT repo, under settings.

For HEROKU_APP, create a new app in HEROKU and put its name in the same way in GIT secrets.