0

I'm trying to create a workflow that will create a tag, generate a changelog and push it to the main branch.
For some reason that I haven't understood yet, I cannot push the changelog after the tag was created, I've tried it both with a new workflow and also as an additional step.
If the step Bump Version is removed from the workflow, everything is working.

Here's my action file:

name: CI
on:
  push:
    branches:
      - main
      
permissions:
  contents: write
jobs:
  release:
    runs-on: [ self-hosted ]
    permissions:
      contents: write    
    steps:
      - uses: actions/checkout@v2
      - name: Bump version
        id: tag_version
        uses: mathieudutour/tag-action@v6.0
        with:
          github_token: ${{ secrets.PUSH_TOKEN }}
          default_bump: minor
                    
      - name: "✏️ Generate release changelog"
        uses: heinrichreimer/github-changelog-generator-action@v2.3
        with:
          token: ${{ secrets.PUSH_TOKEN }}
          output: CHANGELOG.md
          headerLabel: "#  Changelog"
          breakingLabel: '###  Breaking'
          enhancementLabel: '###  Enhancements'
          bugsLabel: '###  Bug fixes'
          stripGeneratorNotice: true
          issues: false
          issuesWoLabels: false
          pullRequests: true
          prWoLabels: true
          author: true
          verbose: true
          sinceTag: v2.25.0
      - name: Commit CHANGELOG Changes
        run: |
          git config user.name "GitHub Actions"
          git config user.email noreply@github.com
          git add CHANGELOG.md
          git commit -m 'Update Changelog.'
          git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}          
          git push
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The error that I'm getting here:
error: src refspec refs/heads/main matches more than one

Tomer Leibovich
  • 313
  • 5
  • 17
  • The answer to [this question](https://stackoverflow.com/questions/70584317/git-push-error-dst-refspec-refs-heads-main-matches-more-than-one) might help you understand what is happening. – GuiFalourd Feb 22 '22 at 17:56
  • 1
    That's a peculiar error to get, but the link @GuiFalourd provided probably contains the key clues. Run `git for-each-ref` or similar to dump out all the refs. Then inspect this tag-action to see if it contains bugs. – torek Feb 23 '22 at 03:03

0 Answers0