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

Documentation on creating a GITHUB_TOKEN secret #8

Closed
coliff opened this issue Sep 12, 2019 · 8 comments · Fixed by #9
Closed

Documentation on creating a GITHUB_TOKEN secret #8

coliff opened this issue Sep 12, 2019 · 8 comments · Fixed by #9

Comments

@coliff
Copy link

coliff commented Sep 12, 2019

I added:

name: Compress images
on: pull_request
jobs:
  build:
    name: calibreapp/image-actions
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - name: calibreapp/image-actions
        uses: docker://calibreapp/github-image-actions
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }

as .github/workflows/calibreapp-image-actions.yml to a private repo. The bottom of the README for this project says:

This action requires a GITHUB_TOKEN secret so that it has access to commit the optimised images to your repository.

Where do you create that GITHUB_TOKEN secret though? Or is it done automatically? I see you can add Secrets via the Settings > Secrets menu, but do I need to enter a specific name? This part isn't very clear....

@tonydehnke
Copy link

tonydehnke commented Sep 12, 2019

Same here, doing some googling it seems that "Github Actions" are still in beta, so we may have to apply to the Beta in order for this to work and see the Secrets menu. Check out this post for some screen shots of it: https://docs.launchdarkly.com/docs/github-actions

Here is the link to Github actions to sign up for the beta: https://github.com/features/actions

@coliff
Copy link
Author

coliff commented Sep 12, 2019

thanks for the reply @tonydehnke - I do have Beta access to GitHub Actions already. I see the 'Actions' tab in my private repo and a couple of failed builds - but with no details other than:

### ERRORED 16:13:26Z

- There was an unexpected error when executing this Action. For help debugging what went wrong, please contact support@github.com.

@benschwarz
Copy link
Member

Hey @coliff, thanks for lodging this issue.

On earlier versions of GitHub actions the GITHUB_TOKEN would've been manually granted by you. That changed when GitHub CI was announced, but I hadn't taken the time to document it properly.

I've updated the docs in #9. Do they make sense to you?

@benschwarz
Copy link
Member

@tonydehnke Seems like you've got something else going wrong. If you wouldn't mind reading through all the output generated and seeing if you can spot an error, I'd appreciate it.

Once you've done so, open a new issue?

@coliff
Copy link
Author

coliff commented Sep 13, 2019

Hi Ben - thanks for the reply and updating the documentation. I've got it working now :-)
Great job on this project. 👍

@coliff
Copy link
Author

coliff commented Sep 13, 2019

actually, nope, error on actions/checkout@master step:

Added matchers: 'checkout-git'. Problem matchers scan action output for known warning or error strings and report these inline.
##[add-matcher]/home/runner/work/_temp/git_c250bbe4-6c28-42a6-a2d9-873bd494e464.json
Syncing repository: coliff/calibre-image-actions-test
git version
git version 2.23.0
git lfs version
git-lfs/2.8.0 (GitHub; linux amd64; go 1.12.6)
git init "/home/runner/work/calibre-image-actions-test/calibre-image-actions-test"
Initialized empty Git repository in /home/runner/work/calibre-image-actions-test/calibre-image-actions-test/.git/
git remote add origin https://github.com/coliff/calibre-image-actions-test
git config gc.auto 0
git config --get-all http.https://github.com/coliff/calibre-image-actions-test.extraheader
git config --get-all http.proxy
git -c http.extraheader="AUTHORIZATION: basic ***" fetch --tags --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/pull/4/merge:refs/remotes/pull/4/merge
##[error]fatal: couldn't find remote ref refs/pull/4/merge
##[warning]Git fetch failed with exit code 128, back off 5.375 seconds before retry.
git -c http.extraheader="AUTHORIZATION: basic ***" fetch --tags --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/pull/4/merge:refs/remotes/pull/4/merge
##[error]fatal: couldn't find remote ref refs/pull/4/merge
##[warning]Git fetch failed with exit code 128, back off 4.154 seconds before retry.
git -c http.extraheader="AUTHORIZATION: basic ***" fetch --tags --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/pull/4/merge:refs/remotes/pull/4/merge
##[error]fatal: couldn't find remote ref refs/pull/4/merge
Removed matchers: 'checkout-git'
##[remove-matcher owner=checkout-git]
##[error]Git fetch failed with exit code: 128
##[error]Exit code 1 returned from process: file name '/home/runner/runners/2.157.5/bin/Runner.PluginHost', arguments 'action "GitHub.Runner.Plugins.Repository.CheckoutTask, Runner.Plugins"'.

Public repo for testing: https://github.com/coliff/calibre-image-actions-test

@benschwarz
Copy link
Member

Looks like you got it working now 🎉

@coliff
Copy link
Author

coliff commented Sep 13, 2019

YEAH! thanks for looking into this.

The error was that I made a PR (by adding a new JPEG image) and then merged it right away. The GitHub Action then tried to run by optimising the image but it couldn't update the PR since I'd already merged it. I think this could potentially trip up other users. After you make a PR you gotta wait a bit before merging. I realise this is a GitHub Actions issue rather than calibreapp-image-actions problem though. Maybe it could be documented somewhere as a side note...

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

Successfully merging a pull request may close this issue.

3 participants