helaili / jekyll-action

A GitHub Action to publish Jekyll based content as a GitHub Pages site
MIT License
250 stars 120 forks source link

Using GitHub token #59

Closed UweTrottmann closed 3 years ago

UweTrottmann commented 4 years ago

Regarding the "Known limitation" in the README I wanted to share that for me the following did not work (for a private repo):

- uses: helaili/jekyll-action@2.0.4
  env:
    # This does NOT work!
    JEKYLL_PAT: ${{ secrets.GITHUB_TOKEN }}

fatal: could not read Password for 'https://***@github.com': No such device or address

However, this does:

- uses: helaili/jekyll-action@2.0.4
  env:
    JEKYLL_PAT: ${{ github.actor }}:${{ github.token }}

Note that github.token is the same as secrets.GITHUB_TOKEN, I just chose it for consistency (e.g. both work).

Background: I didn't want to use a Personal Access Token because it allows write access to all repos. The token from the github context expires once the job is done. Note that I don't use GitHub Pages, so I'm not sure if the above solves the initial deployment issue (see #34). Maybe someone could check?

Thanks for this useful action!

AfzalivE commented 4 years ago

I think this is a better way than creating a personal access token that allows access to all repos.

Thank you for sharing!

oDinZu commented 3 years ago

I was using the personal access token and ran into permission problems pushing to master on the organizational account. After testing the JEKYLL_PAT: ${{ github.actor }}:${{ github.token }} the build was possible with v2 and pushed to master and created gh-pages branch as intended.

A while back, i got this working with v2.0.1 only; any other version on the organizational level failed with same result I had above with a new org. account.

Thanks for sharing @UweTrottmann