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

Sync Folder #251

Open
blushell opened this issue Sep 17, 2023 · 7 comments
Open

Sync Folder #251

blushell opened this issue Sep 17, 2023 · 7 comments

Comments

@blushell
Copy link

blushell commented Sep 17, 2023

Not sure if I am doing correct if is possible but i want just the content from folder from source repo to sync just to folder in target repo.

name: FASTDL Test

on: workflow_dispatch

jobs:
   fastdl_sync:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout FW Repo
        uses: adrianjost/[email protected]
        with:
          GITHUB_TOKEN: ${{secrets.TOKEN}}
          SRC_REPO: DarklandServers/fortwars
          SRC_ROOT: ./gamemodes/fortwarsremastered/content-compressed/
          TARGET_REPOS: DarklandServers/fastdl
          TARGET_ROOT: ./fw/
          DRY_RUN: false
@adrianjost
Copy link
Owner

You need to also specify the FilePatterns you want to sync from those folders.

note: please use proper formatting of code, to make reading your issues easier.
You just need to add ``` before and after your code.

@blushell
Copy link
Author

I had tried that. I may be still doing it wrong though. I would like all the files and sub folders from SRC path sync to path on target.

name: FASTDL Test

on: workflow_dispatch

jobs:
   fastdl_sync:
    name: Checkout FW Repo
    runs-on: ubuntu-latest
    steps:
      - name: Checkout dev repository
        uses: actions/checkout@v3
      - uses: adrianjost/files-sync-action@master
        with:
          GITHUB_TOKEN: ${{ secrets.TOKEN }}
          SRC_REPO: 'DarklandServers/fortwars'
          SRC_ROOT: '/gamemodes/fortwarsremastered/content-compressed/'
          FILE_PATTERNS: |
            ^gamemodes/fortwarsremastered/content-compressed/        
          TARGET_REPOS: |
            DarklandServers/fastdl
          TARGET_ROOT: '/fw/'
          DRY_RUN: false

I also tried ^gamemodes/fortwarsremastered/content-compressed/*

@adrianjost
Copy link
Owner

I'm not sure about what the code does anymore and my documentation about SRC_ROOT could be better. My guess is, that If you specify a SRC_ROOT your FILE_PATTERNS should be relative to this SRC_ROOT. So in this case, I guess it should be a RegExp that matches everything.

Try out the following and let me know if it works.
if It does, a PR that clarifies the Documentation would be appreciated.

name: FASTDL Test

on: workflow_dispatch

jobs:
   fastdl_sync:
    name: Checkout FW Repo
    runs-on: ubuntu-latest
    steps:
      - name: Checkout dev repository
        uses: actions/checkout@v3
      - uses: adrianjost/files-sync-action@master
        with:
          GITHUB_TOKEN: ${{ secrets.TOKEN }}
          SRC_REPO: 'DarklandServers/fortwars'
          SRC_ROOT: '/gamemodes/fortwarsremastered/content-compressed/'
          FILE_PATTERNS: |
            .*        
          TARGET_REPOS: |
            DarklandServers/fastdl
          TARGET_ROOT: '/fw/'
          DRY_RUN: false

@adrianjost adrianjost reopened this Sep 18, 2023
@blushell
Copy link
Author

blushell commented Sep 19, 2023

That does not seem to work.
Its weird because it syncs everything from /gamemodes/fortwarsremastered/content-compressed/ to the /fw/ folder in the other repo. But it also syncs everything from root of src repo.

@adrianjost
Copy link
Owner

I have no immediate idea anymore. But I know that the config here works. It's almost the same use-case, but for specific files. Maybe there is a Syntax difference and you could look into it.

It would also help debugging, if you could narrow down the problem a bit further.

  • Does it work when only syncing specific files in that repository?
  • Does the same config works in other repositories?
  • ...

Currently the issue is just to broadly described to help you any further.

@ReenigneArcher
Copy link

I'm facing the same problem. I think the SRC_ROOT is being ignored for some reason. As far as I can interpret, this is the right syntax according to your example here (https://github.com/adrianjost/.github/blob/main/.github/workflows/sync.yml#L40)

    - uses: adrianjost/[email protected]
      with:
        COMMIT_MESSAGE: "Update ${{ github.repository }} to ${{ github.sha }}"
        FILE_PATTERNS: |-
          ^Formula/*.rb$
        GIT_EMAIL: ${{ secrets.git_email }}
        GIT_USERNAME: ${{ secrets.git_username }}
        GITHUB_TOKEN: ${{ secrets.git_pat}}
        SRC_ROOT: /tests/  # also tried with ${{ github.workspace }} as the prefix
        TARGET_REPOS: ${{ github.repository }}:tests
Run adrianjost/[email protected]
Context: {
  "COMMIT_MESSAGE": "Update LizardByte/homebrew-release-action to 20c180e8f938ada831c899728ac9a85f258437b4",
  "DRY_RUN": false,
  "FILE_PATTERNS": [
    {}
  ],
  "GITHUB_SERVER": "github.com",
  "GITHUB_TOKEN": "<secret>",
  "GIT_EMAIL": "***",
  "GIT_USERNAME": "***",
  "SKIP_CLEANUP": false,
  "SKIP_DELETE": false,
  "SKIP_REPLACE": false,
  "SRC_REPO": "LizardByte/homebrew-release-action",
  "SRC_ROOT": "/tests/",
  "TARGET_REPOS": [
    "LizardByte/homebrew-release-action:tests"
  ],
  "TARGET_ROOT": "/",
  "TMPDIR": "tmp-1709838547247"
}
EXEC: "GIT_LFS_SKIP_SMUDGE=1 git clone --depth 1 https://***@github.com/LizardByte/homebrew-release-action.git tmp-1709838547247/LizardByte/homebrew-release-action" IN "./"
OUTPUT STDOUT: none
FILE_PATTERNS [
  "/^Formula\\/*.rb$/"
]
MATCHING FILES: []
EXEC: "GIT_LFS_SKIP_SMUDGE=1 git clone --depth 1  -b tests https://***@github.com/LizardByte/homebrew-release-action.git tmp-1709838547247/LizardByte/homebrew-release-action-tests" IN "./"
OUTPUT STDOUT: none
FILE_PATTERNS [
  "/^Formula\\/*.rb$/"
]
MATCHING FILES: []
REMOVE FILES []
EXEC: "git status --porcelain" IN "tmp-1709838547247/LizardByte/homebrew-release-action-tests"
OUTPUT STDOUT: none
NO CHANGES DETECTED

@adrianjost
Copy link
Owner

@ReenigneArcher
Your filepattern does not look quite right. /* matches a / 0-infinite many times, followed by . matching any character (but just once) and then ending on rb. So I think it is likely a different issue.
You can test your regex using https://regex101.com/

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

No branches or pull requests

3 participants