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

[Bug]: allow submodules #402

Closed
1 task done
centifanto opened this issue Oct 6, 2023 · 5 comments
Closed
1 task done

[Bug]: allow submodules #402

centifanto opened this issue Oct 6, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@centifanto
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

This action is exactly what I was looking for, thank you. I am using a Jekyll template repo, and wanted to use your action to keep my repo up to date

However, this template has a submodule for some of it's static assets --> https://github.com/cotes2020/chirpy-starter/tree/main/assets

I ran into this error:
error: 'assets/lib' does not have a commit checked out

So I decided to just remove (with rm -rf ) my repo's copy since it would be subsequently updated with the pull form remote

Upon removing, it seemed like solved the issue. But then this error popped up:
Could not access submodule 'assets/lib'

Expected Behavior

The action to allow pulling submodules from the remote

Current Behavior

It fails when trying to pull the submodule, either because it has .git information, or when removing it can't fetch that remote module.

Steps To Reproduce

No response

Possible Solution

No response

Additional Information/Context

No response

Template sync version Version

1.1.3

@centifanto centifanto added the bug Something isn't working label Oct 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2023

Hi! Thank you for your contribution!'Happy coding! 🚀

@AndreasAugustin
Copy link
Owner

Hi @centifanto and thank you for the issue.
I had a short look into your public repo.
So far this action does not support git submodules (yet).

As a fast workaround you could try the following:
For checking out the source code you use actions/checkout@v3 action.
The action has an option to checkout submodules

    # Whether to checkout submodules: `true` to checkout submodules or `recursive` to
    # recursively checkout submodules.
    #
    # When the `ssh-key` input is not provided, SSH URLs beginning with
    # `[email protected]:` are converted to HTTPS.
    #
    # Default: false
    submodules: ''

So instead of doing the rm -rf like mentioined above you could try to change the action to

on:
    # cronjob trigger
  # schedule:
  # - cron:  "0 0 1 * *"
  # manual trigger
  workflow_dispatch:
jobs:
  repo-sync:
    runs-on: ubuntu-latest
    steps:
      # To use this repository's private action, you must check out the repository
      - name: Checkout
        uses: actions/checkout@v3
        with:
          submodules: true
      # - name: remove submodule
      # run: |
      #    rm -rf assets/lib
      - name: actions-template-sync
        uses: AndreasAugustin/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          source_repo_path: cotes2020/chirpy-starter
          git_remote_pull_params: --allow-unrelated-histories --squash --strategy=recursive

theoretically this should do the trick :)

@centifanto
Copy link
Author

Thanks so much for your reply @AndreasAugustin!

Haha that is funny, your solution is exactly what I found in my initial research and was thinking of trying! I was going to offer it as a potential workaround, but I thought it wouldn't work since your module would still fail upon seeing my local copy of this submodule (the first error I ran into).

Either way, thank you. I will try it out and report back :)

@centifanto
Copy link
Author

that worked, thank you @AndreasAugustin

@AndreasAugustin
Copy link
Owner

Perfect! Thx for the investigation @centifanto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants