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

Default branch should be "main" not "master" #68

Open
juancpineda97 opened this issue Dec 4, 2020 · 9 comments
Open

Default branch should be "main" not "master" #68

juancpineda97 opened this issue Dec 4, 2020 · 9 comments

Comments

@juancpineda97
Copy link
Contributor

Due to the latest changes to Github, the default branches are now called "main" and not "master". Therefore, the default branch should be "main".

@ouuan
Copy link

ouuan commented Jan 3, 2021

Why not use ${{ github.ref }} as default? (Another breaking change, though.)

@counter2015
Copy link

It's strange when I see my workflow failed due to this reason.
Since it's a break strange, why not update another version of workflow instread of modifying it directly?

@ad-m
Copy link
Owner

ad-m commented Jan 4, 2021

@counter2015 , there is no release yet and there is no updates of already released version. Use latest version. master detect branch automatically and should not raise issues like that.

@counter2015
Copy link

@counter2015 , there is no release yet and there is no updates of already released version. Use latest version. master detect branch automatically and should not raise issues like that.

@ad-m I'm not sure, you mean that this issue is fixed in master version?

I didn't specify version, and the ad-m/github-push-action@master version like following:

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

I fixed it by following steps

  • delete main branch
  • use github.ref in config
  • trigger wrokflow manually by on: workflow_dispatch
    - name: Push
      uses: ad-m/github-push-action@master
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        branch: master

@ad-m
Copy link
Owner

ad-m commented Jan 4, 2021

PR #69 switch default branch to main. PR #75 (merged a 43 minutes ago) introduce autodiscovery of default branch (usually between master and main).

The simplest solution is use explicit branch (branch: master) or explicit version (uses: ad-m/github-push-action@v0.6.0). However, in most cases of user of uses: ad-m/github-push-action@master the new default configuration (branch detection) should work fine.

@nikeee
Copy link

nikeee commented Jan 5, 2021

This thing broke my build and I got a lot of mails from GitHub.

PR #75 did not fix it for me as I still got mails from GitHub. Part of the stack trace:

Error: Invalid status code: 404
    at IncomingMessage.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:14:21)
    at IncomingMessage.emit (events.js:215:7)
    at endReadableNT (_stream_readable.js:1184:12)

This may be caused by the repository being private.

Fixed by specifying the branch explicitly using branch: master.
Lesson learned: Don't rely on @master (please, don't change that name aswell). Maybe the sample in the readme should always use the latest stable tag instead of @master.

@ad-m
Copy link
Owner

ad-m commented Jan 5, 2021

@nikeee , are you using public GitHub instance or GitHub EE or something like that? Actions use GitHub token, so it should works for private repositories too.

I added extra logging to see what is missing 821c9b7 .

@nikeee
Copy link

nikeee commented Jan 5, 2021

The res object (that gets assigned to the error) contained these fields:

    url: '',
    method: null,
    statusCode: 404,

The request (res.req) contained these fields:

      _header: 'GET /repos/<my-gh-name>/<my-private-repo> HTTP/1.1\r\n' +
        'User-Agent: github.com/ad-m/github-push-action\r\n' +
        'Host: api.github.com\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'GET',
      path: '/repos/<my-gh-name>/<my-private-repo>',

Using the public GitHub instance (no EE/On-Prem), but a private repository.

@ad-m
Copy link
Owner

ad-m commented Jan 9, 2021

I believe authorization issue is solved in commit 057a6ba . No longer branch: master is necessary and discovery of branch should works without any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants