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

Add a way to mirror the directory struture when uploading a file. #9

Merged
merged 1 commit into from
Aug 7, 2022
Merged

Add a way to mirror the directory struture when uploading a file. #9

merged 1 commit into from
Aug 7, 2022

Conversation

wrong-kendall
Copy link

This is a pretty basic version that will recreate the local paths relative to folderId. It won't recreate complex structures in one step but it's a start to addressing #6, It still uses os.Glob so it won't recurse and instead just skips directories so to fully mirror the paths, you'd need to specify each level.

@wrong-kendall
Copy link
Author

I tested with:

# .github/workflows/main.yml
name: Main
on:
  push:
  workflow_dispatch:
https://github.com/wrong-kendall/google-drive-upload-git-action/runs/7594481993?check_suite_focus=true#step:5:26
jobs:
  my_job:
    runs-on: ubuntu-latest

    steps:

      - name: Checkout code
        uses: actions/checkout@v2
      - name: Make dir structure
        run: |
          mkdir -p this/is/just/a/test/differentdir
          date > this/is/just/a/test/testfile1.$(date +%s)
          date > this/is/just/a/test/testfile2.$(date +%s)
          touch this/is/just/a/test/differentdir/testfile3.$(date +%s)

      - name: Mirror Directory Structure
        uses: wrong-kendall/google-drive-upload-git-action@main
        with:
          credentials: ${{ secrets.DRIVE_CREDENTIALS }}
          filename: this/is/just/a/test/differentdir/*
          folderId: ${{ secrets.FOLDER_ID }}
          overwrite: "true"
          mirrorDirectoryStructure: "true"
      - name: Mirror More Directory Structure
        uses: wrong-kendall/google-drive-upload-git-action@main
        with:
          credentials: ${{ secrets.DRIVE_CREDENTIALS }}
          filename: this/is/just/a/test/*
          folderId: ${{ secrets.FOLDER_ID }}
          overwrite: "true"
          mirrorDirectoryStructure: "true"

and here's the output: https://github.com/wrong-kendall/google-drive-upload-git-action/runs/7594481993?check_suite_focus=true#step:5:26

@adityak74
Copy link
Owner

Thanks, @wrong-kendall for working on this one. It was a long-awaited feature.

@adityak74 adityak74 merged commit 647044c into adityak74:main Aug 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants