question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Default Branch should be triggered branch not Master

See original GitHub issue

The reason for this is because i was having hair pulling troubles trying to figure out how to get this action to push to the branch that triggered the script. Due to the complexity of github actions.

In addition, this Action name’s “intent” is just push, which by default I would expect it to only push on the triggered branch, not merge to master.

Either it should by default push to trigger branch or give the example to do so in the readme file.

      uses: ad-m/github-push-action@master
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        branch: ${{ github.head_ref }}

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:40
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
Gummibeercommented, Feb 8, 2020

@koppor

The former is for the .yml file (Syntax: GitHub Actions), the latter is inside https://github.com/ad-m/github-push-action/blob/master/start.sh (Syntax: Bash).

The advantage of the latter approach is that the script will also work when triggered in a push. Otherwise, it will only work in a pull_request event. (As far as I did not do something wrong in my experiements this morning. There, the variable github.head_ref was empty in the case of a push event)

You can use the ref instead of head_ref for push events. https://help.github.com/en/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context

3reactions
jcislinskycommented, Jan 31, 2020

I set our CI to use this plugin to push only tags. So I didn’t set branch and I thought that it will push only tags. But a very weird thing happened. Every time our workflow finished a deploy from any branch it ‘force’ pushes the current branch to the master. 😲

Maybe I did not read the documentation properly but I still think that if I don’t specify the branch, it should push to the current or doesn’t push branch at all.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The new Git default branch name - GitLab
Default branch name changes for GitLab.com and self-managed users: When creating a new project in GitLab, the default branch name will change ...
Read more >
github default branch is main but not master - Stack Overflow
You can pick whatever default branch you like: docs.github.com/en/free-pro-team@latest/github/… – jonrsharpe · Thanks. · FYI: The change from ...
Read more >
Branches in a Nutshell - Git SCM
A branch in Git is simply a lightweight movable pointer to one of these commits. The default branch name in Git is master...
Read more >
The default branch for newly-created repositories is now main
The default branch name for new repositories is now main . To set a different default: ... Users, organizations, and enterprises that previously ......
Read more >
Change the default branch - Azure Repos | Microsoft Learn
A Git repository can only have one default branch. However, for a while, you can set up ad-hoc mirroring between your old default...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found