Cannot push on repo when release is triggered

Hi!

I’m facing a weird issue, when a push or workflow_dispatch is triggered i can update my repository by committing the files i need to update. But when a published release is triggered i can’t.

I’ve tested many different approaches and it’s always the same thing, i can’t perform push on the repository, each time it fail with this error:

1 file changed, 1 insertion(+), 1 deletion(-)
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/antoine-pous/antoine-pous-test'

My current workflow is:

name: NPM publish release
on:
  workflow_dispatch:
  release:
    types: [published]
jobs:
  build:
    runs-on: ubuntu-latest
    env:
      NODE_ENV: development
      PACKAGE_VERSION: ${{ github.event.release.tag_name }} 

    steps:
      - name: checkout
        uses: actions/checkout@v2
      - name: setup node
        uses: actions/setup-node@v2-beta
        with:
          node-version: '14.15.1'
      - name: Update package version
        uses: deef0000dragon1/json-edit-action/@v1
        env:
          KEY: version
          VALUE: ${PACKAGE_VERSION}
          FILE: package.json
      - name: Install dependencies
        run: |
          yarn policies set-version '1.22.10'
          yarn install  
      - name: Push new package.json
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          git config --global user.name ${{ secrets.BOT_USERNAME }}
          git config --global user.email ${{ secrets.BOT_EMAIL }}
          git add .
          git commit package.json -m "Bump version ${PACKAGE_VERSION}"
          git push origin main

Another issue is, i can’t put my PACKAGE_VERSION var as part of the commit message and the value of my Update package version job. This is really weird, I’ve tried concatenation but nothing seem works :frowning:

Thanks for your help :slight_smile: