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

Action passed with silent failure when no gh-pages branch existed #31

Closed
softprops opened this issue Sep 22, 2019 · 5 comments
Closed
Labels
bug Something isn't working duplicate This issue or pull request already exists resolved

Comments

@softprops
Copy link

Thanks for publishing this action.

I followed the readme instructions but ran into what may be a common but undocumented case.

I'm publishing for the first time and no gh-pages branch exists.

The action proceeds to stage changes but they never get pushed to my PUBLISH_BRANCH

Cloning into '/github/home/b8c542550a778e3eb0ca70abff3d5482'...
warning: Could not find remote branch gh-pages to clone.
fatal: Remote branch gh-pages not found in upstream origin
Initialized empty Git repository in /github/workspace/target/doc/.git/
Switched to a new branch 'gh-pages'
fatal: No such remote: 'origin'
INFO: Allowing empty commits: 
[gh-pages (root-commit) 975a973] Automated deployment: Sun Sep 22 04:26:54 UTC 2019 3a9dc85d243d35fe33b4992ae2a042c6793e8861
 131 files changed, 15230 insertions(+)
 create mode 100755 .lock
...more files...

My workflow step is configured with

- name: Publish
        uses: docker://peaceiris/gh-pages:v2.3.1
        env:
          PUBLISH_BRANCH: gh-pages
          PUBLISH_DIR: ./target/doc
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@peaceiris
Copy link
Owner

peaceiris commented Sep 22, 2019

Thank you. This issue is related to #29. I will fix this at #28

And, please do not use GITHUB_TOKEN #9
Try with ACTIONS_DEPLOY_KEY or PERSONAL_TOKEN

actions-gh-pages/README.md at 74f032c7e9f7be7e56320d6df9ca8707e104da12 · peaceiris/actions-gh-pages

NOTES: This action supports GITHUB_TOKEN but it has some problems to deploy to GitHub Pages. See #9

Please try the following.

  1. Use ACTIONS_DEPLOY_KEY or PERSONAL_TOKEN
  2. Set emptyCommits: true
      - name: Publish
        uses: docker://peaceiris/gh-pages:v2.3.1
        env:
+          ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
          PUBLISH_BRANCH: gh-pages
          PUBLISH_DIR: ./target/doc
+      with:
+        emptyCommits: true

peaceiris added a commit that referenced this issue Sep 22, 2019
@peaceiris peaceiris added bug Something isn't working duplicate This issue or pull request already exists labels Sep 22, 2019
@softprops
Copy link
Author

I'll take a look. Thanks for the fast response.

It may be worth documenting for users what permission the default github token is missing. Here's a list GitHub actions documents https://help.github.com/en/articles/virtual-environments-for-github-actions#github_token-secret. I realize these aren't enough to do everything but easy to miss for users of this action.

@peaceiris
Copy link
Owner

peaceiris commented Sep 22, 2019

Thank you for your suggestion.

There is a bug to deploy to GitHub Pages from GitHub Actions with GITHUB_TOKEN. Read this: Github action not triggering gh-pages upon push - GitHub Community Forum

GitHub team is investigating this problem. We are waiting for replies from them.

@softprops
Copy link
Author

Status update. This worked like a charm after generating a PERSONAL_TOKEN and setting emptyCommits: true

peaceiris added a commit that referenced this issue Sep 23, 2019
* fix: Fixes for docker hub image (INPUT_EMPTYCOMMITS false condition)
* fix: Add skip function

Close #27
Close #31 
Keep open #29 

* gha: Add fetch-depth 1 to actions/checkout
* gha: Add pull_request trigger, Close #32
@github-actions
Copy link
Contributor

This issue has been LOCKED because of it being resolved!

The issue has been fixed and is therefore considered resolved.
If you still encounter this or it has changed, open a new issue instead of responding to solved ones.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working duplicate This issue or pull request already exists resolved
Projects
None yet
Development

No branches or pull requests

2 participants