---
version: '3'

tasks:
  sync:ssh-keys:
    deps:
      - :install:software:heroku
    cmds:
      - .config/log info 'Clearing Heroku SSH keys'
      - heroku keys:clear
      - .config/log start 'Syncing SSH keys with Heroku'
      - |
        for KEY in `ls $HOME/.ssh/*.pub`; do
          heroku keys:add "$KEY"
        done
      - .config/log success 'Finished syncing SSH keys with Heroku'
    preconditions:
      - sh: '[ -n "$HEROKU_API_KEY" ]'
        msg: The HEROKU_API_KEY must be set to a personal access token.
