Code Monkey home page Code Monkey logo

Comments (7)

yy4382 avatar yy4382 commented on May 25, 2024 1

I encountered the same issue. The problem is triggered under two conditions:

  1. The target repo is an empty repo, with no commits.
  2. The selected target branch is an existing branch within the repo (such as the default 'main' branch), but no commits have been made on this branch.

It seems that when there are no commits in the selected branch, this action tries to create it, but this branch actually already exists.

I suspect that the issue may be triggered if a target branch does not have any commits (not just in wholly new repositories), but haven't tested yet.

BTW:

  • my solution: commit some random things in the target repo in target branch to make it not empty
  • the error message is misleading: the error occurs when trying to remove the worktree in the end, and the real failure is in the "info" of the output.

the error message:

/usr/bin/git worktree remove github-pages-deploy-action-temp-deployment-folder --force
Error: The deploy step encountered an error: There was an error creating the worktree: The process '/usr/bin/git' failed with exit code 128 ❌ ❌

from github-pages-deploy-action.

JamesIves avatar JamesIves commented on May 25, 2024

Does it work if you turn single-commit to false? This may be access token scope related as cross-deploying to repos with single-commit should work. Can you try increasing the permissions and see if that works?

from github-pages-deploy-action.

nschloe avatar nschloe commented on May 25, 2024

Does it work if you turn single-commit to false?

Nope, same error.

It does work if I set the branch to anything else but main, e.g.,

branch: main2

from github-pages-deploy-action.

JamesIves avatar JamesIves commented on May 25, 2024

Couple of questions:

  • Is main protected?
  • What scopes have you given your PAT?
  • Is the account that the PAT was generated from admin of the org or have admin privileges in the repo?

from github-pages-deploy-action.

nschloe avatar nschloe commented on May 25, 2024

Is main protected?

When creating a repo via the API as in the original post, there is no code, and no branch main in the repo. It's an empty repo.

What scopes have you given your PAT?

Full access to private repos.

Is the account that the PAT was generated from admin of the org or have admin privileges in the repo?

Yes.

(I don't think permissions are a problem since I can create repos with the key, and it all works if I use main2 as a branch name.)

The error message suggests that github-pages-deploy-actions calls

/usr/bin/git checkout --orphan main

in a repo where a main branch already exists. Not sure at all why it does that. Perhaps the current working directory needs to be changed at some point before that?

from github-pages-deploy-action.

nhuet avatar nhuet commented on May 25, 2024

I got the same issue when deploying with "single-commit=true" + "clean:false" to the root "/" of an orphan branch (gh-pages).

This works:

      - name: Commit versions.json
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          branch: gh-pages # The branch the action should deploy to.
          folder: versions_folder # The folder the action should deploy.
          target-folder: / # The folder the action should deploy to.
          commit-message: publish documentation
          clean: false  # do not remove other files (including whole doc versions)

This does not work:

      - name: Commit versions.json
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          branch: gh-pages # The branch the action should deploy to.
          folder: versions_folder # The folder the action should deploy.
          target-folder: / # The folder the action should deploy to.
          commit-message: publish documentation
          clean: false  # do not remove other files (including whole doc versions)
          single-commit: true

This worked also:

  • with single-commit:true without clean, and to a subfolder:
      - name: Deploy documentation in a version subfolder on GH pages
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          branch: gh-pages # The branch the action should deploy to.
          folder: docs/build/html # The folder the action should deploy.
          target-folder: /main # The folder the action should deploy to.
          commit-message: publish documentation
          single-commit: true
  • with single-commit:true, to the root, with a clean-exclude pattern
      - name: Deploy documentation in root folder on GH pages πŸš€
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          branch: gh-pages # The branch the action should deploy to.
          folder: docs/.vuepress/dist # The folder the action should deploy.
          target-folder: / # The folder the action should deploy to.
          commit-message: publish documentation
          single-commit: true
          clean-exclude: |
            "version/*"

from github-pages-deploy-action.

nhuet avatar nhuet commented on May 25, 2024

I found why i add examples working and others not working. Actually in the example not working (single-commit:true) i was also doing a checkout of gh-pages (the very branch on which i want to deploy) before in order to parse something. So this is the sequence making the bug:

  • checkout gh-pages
  • do some stuff
  • try to publish on gh-pages (same branch) with "single-commit:true" (without single-commit, it is actually working)
  update-doc-versions:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          ref: gh-pages
      - name: Do some stuff to generate something in versions_folder
        run: ...
      - name: Commit versions.json
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          branch: gh-pages # The branch the action should deploy to.
          folder: versions_folder # The folder the action should deploy.
          target-folder: / # The folder the action should deploy to.
          commit-message: publish documentation
          clean: false  # do not remove other files (including whole doc versions)
          single-commit: true

from github-pages-deploy-action.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.