question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failure on copyAssets when using external_repository, publish_dir and destination_dir

See original GitHub issue

Describe the bug

I am trying to publish a subdirectories content on a given branch on a private repository A onto a remote private repository B into a subfolder. The process fails with an error when the branch already exists with content. It works when the branch does not exist yet.

The reason for this setup is, the generated website will not be hosted via gh-pages on Github but being uploaded to a remote server from the remote private repository B using Github Actions and SamKirkland/FTP-Deploy-Action.

  • So we have the hugo source in repository A
  • On Repository A we build using github actions and push the generated page to repository B
  • On Repository B another github action is now running pushing the generated page via SFTP to the final server
  • This way it is possible to only upload the changed pages instead of upload everything over and over again (>800 generated pages)

To Reproduce

  1. Set up an action with the configuration shown below
  2. Run with the remote repository not having a main branch
  3. Run again and receiving a failure.
 ##[group]Prepare publishing assets
 [INFO] ForceOrphan: false
 [command]/usr/bin/git clone --depth=1 --single-branch --branch automated git@github.com: username/deploy-staging.git /home/runner/actions_github_pages_1595511235704
 Cloning into '/home/runner/actions_github_pages_1595511235704'...
 [INFO] clean up /home/runner/actions_github_pages_1595511235704/public
 [command]/usr/bin/git rm -r --ignore-unmatch *
 rm 'public/404.html'
 rm 'public/...'
 [INFO] first deployment, create new branch automated
 EISDIR: illegal operation on a directory, copyfile '/home/runner/work/username/sourcerepository/public/404.html' -> '/home/runner/actions_github_pages_1595511235704/public/'
 [command]/usr/bin/git init
 Reinitialized existing Git repository in /home/runner/actions_github_pages_1595511235704/.git/
 [command]/usr/bin/git checkout --orphan automated
 fatal: A branch named 'automated' already exists.
 ##[error]Action failed with "The process '/usr/bin/git' failed with exit code 128"

Expected behavior

The copy files process to the empty destination repository should not fail.

Your YAML file

name: staging deploy

on:
  push:
    branches:
      - develop

jobs:
  deploy:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
        with:
          ref: develop
          submodules: true  # Fetch Hugo themes (true OR recursive)

      - name: setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: '0.74.1'

      - name: build
        run: hugo -D --minify -v

      - name: deploy to staging repo
        uses: peaceiris/actions-gh-pages@v3.7.0-1
        with:
          deploy_key: ${{ secrets.STAGING_DEPLOY_KEY }}
          external_repository: username/deploy-staging
          publish_branch: main
          publish_dir: ./public
          destination_dir: public
          allow_empty_commit: false
          commit_message: ${{ github.event.head_commit.message }}

Additional context

The error is thrown here: https://github.com/peaceiris/actions-gh-pages/blob/09b03c0bb13c9e157adadcaaaee5ca4618ea8f1e/src/git-utils.ts#L24

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
peaceiriscommented, Jul 25, 2020

I really appreciate what you’ve done! After adding some tests and refactoring, the v3.7.0 will be released. Until then, we can use v3.7.0-4. Thank you very much. 😄

1reaction
DerAndereAndicommented, Jul 24, 2020

Please let me know if there is anything else I can do to help

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found