Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: No longer works with default push settings #573

Closed
1 task done
icco opened this issue Oct 15, 2024 · 7 comments · Fixed by #574
Closed
1 task done

[Bug]: No longer works with default push settings #573

icco opened this issue Oct 15, 2024 · 7 comments · Fixed by #574
Assignees
Labels
bug Something isn't working

Comments

@icco
Copy link
Contributor

icco commented Oct 15, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Starting with 2.3, the following config fails:

name: template sync
on:
  # run every day at midnight
  schedule:
    - cron: '0 0 * * *'
  # manually trigger the workflow
  workflow_dispatch:
jobs:
  repo-sync:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          token: ${{ secrets.INFRA_SYNC_TOKEN }}
      - name: actions-template-sync
        uses: AndreasAugustin/actions-template-sync@v2
        with:
          github_token: ${{ secrets.INFRA_SYNC_TOKEN }}
          source_repo_path: "pinginc/template-infra"
          source_repo_ssh_private_key: ${{ secrets.INFRA_TEMPLATE_SYNC_TOKEN }}
          is_pr_cleanup: true

Expected Behavior

I expected this to work as it did in 2.2.3

Current Behavior

The error that occurs is:

  ::info::push changes
  error: src refspec origin does not match any
  error: failed to push some refs to ' --set-upstream'

Steps To Reproduce

Any configuration that does not end up with additional flags for git push

Possible Solution

Rewrite the function at

function push () {
info "push changes"
local branch=$1
local is_force=$2
local is_with_tags=$3
local additional_params=" "
if [ "$is_force" == true ] ; then
warn "forcing the push."
additional_params="${additional_params}--force "
fi
if [ "$is_with_tags" == true ] ; then
warn "include tags."
additional_params="${additional_params}--tags "
fi
git push "${additional_params}"--set-upstream origin "${branch}"
}

Additional Information/Context

No response

Template sync version Version

2.4.0

@icco icco added the bug Something isn't working label Oct 15, 2024
@icco
Copy link
Contributor Author

icco commented Oct 15, 2024

Created #574 to fix

@AndreasAugustin
Copy link
Owner

Hi @icco and thanks a lot for the report and the PR!
Will look ASAP into it

@hdesai-dave
Copy link

we are also blocked by this

@AndreasAugustin
Copy link
Owner

AndreasAugustin commented Oct 15, 2024

we are also blocked by this

@hdesai-dave

🎁

you can always temp mitigate the issue with pining the issue to the last working version. E.g.

      - name: actions-template-sync
        uses: AndreasAugustin/actions-template-sync@v2.2.3
        with:

@AndreasAugustin
Copy link
Owner

Like @icco already mentioned within the description this change is responsible:
01f7623#diff-2c34df082012b54923698ceb27ff084102dc0cbe7f71ce907b4a8ba41657c6edL289

@AndreasAugustin AndreasAugustin self-assigned this Oct 15, 2024
@AndreasAugustin AndreasAugustin moved this from To do to Review in progress in actions-template-sync Oct 15, 2024
@github-project-automation github-project-automation bot moved this from Review in progress to Done in actions-template-sync Oct 15, 2024
AndreasAugustin added a commit that referenced this issue Oct 15, 2024
Signed-off-by: Andy Augustin <dev@andreas-augustin.org>
@AndreasAugustin
Copy link
Owner

further PR with a test improvement #577

AndreasAugustin added a commit that referenced this issue Oct 15, 2024
Signed-off-by: Andy Augustin <dev@andreas-augustin.org>
@AndreasAugustin
Copy link
Owner

@icco thanks a lot for your PR. The issue should be solved with new version v2.4.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

3 participants