files-sync-action icon indicating copy to clipboard operation
files-sync-action copied to clipboard

Unable to find files from SRC_REPO Branch

Open ghost opened this issue 3 years ago • 3 comments

Trying to sync from a branch on the repo, and it won't find any files. The branch exists, and the git clone command printed in the logs works as expected when executed locally. The same setup works fine off of the main branch. No structural or directory changes exist between the two

Here's the action def:

  SyncToPortal:
    name: Sync Files to Dev Portal
    runs-on: ubuntu-latest
    steps:
      - name: File Sync
        uses: adrianjost/[email protected]
        with:
          COMMIT_MESSAGE: Update Synced Standards Docs from %SRC_REPO%
          # SRC_REPO: ${{ github.repository }}:${{ github.ref_name }}
          FILE_PATTERNS: |
            ^general/
          TARGET_ROOT: /developer-portal/standards/
          TARGET_REPOS: |
            health/developer-portal
          GITHUB_TOKEN: ${{ secrets.TOKEN }}
          DRY_RUN: true

And the failing output:

 Context: {
  "COMMIT_MESSAGE": "Update Synced Standards Docs from %SRC_REPO%",
  "DRY_RUN": true,
  "FILE_PATTERNS": [
    {}
  ],
  "GITHUB_SERVER": "github.com",
  "GITHUB_TOKEN": "<secret>",
  "GIT_EMAIL": "[email protected]",
  "GIT_USERNAME": "joelhess",
  "SKIP_CLEANUP": false,
  "SKIP_DELETE": false,
  "SKIP_REPLACE": false,
  "SRC_REPO": "health/development_standards:ATP-503-REST-Api-documentation",
  "SRC_ROOT": "/",
  "TARGET_REPOS": [
    "health/developer-portal"
  ],
  "TARGET_ROOT": "/developer-portal/standards/",
  "TMPDIR": "tmp-1638193377014"
}
health/development_standards:ATP-503-REST-Api-documentation: EXEC: "GIT_LFS_SKIP_SMUDGE=1 git clone --depth 1  -b ATP-503-REST-Api-documentation https://***@github.com/health/development_standards.git tmp-1638193377014/health/development_standards-ATP-503-REST-Api-documentation" IN "./"
health/development_standards:ATP-503-REST-Api-documentation: OUTPUT: "null"
health/development_standards:ATP-503-REST-Api-documentation: FILE_PATTERNS [
  "/^general\\//"
]
health/development_standards:ATP-503-REST-Api-documentation: MATCHING FILES: []
health/developer-portal: EXEC: "GIT_LFS_SKIP_SMUDGE=1 git clone --depth 1 https://***@github.com/health/developer-portal.git tmp-1638193377014/health/developer-portal" IN "./"
health/developer-portal: OUTPUT: "null"
health/developer-portal: FILE_PATTERNS [
  "/^general\\//"
]
health/developer-portal: MATCHING FILES: []
health/developer-portal: REMOVE FILES []
health/developer-portal: EXEC: "git status --porcelain" IN "tmp-1638193377014/health/developer-portal"
health/developer-portal: OUTPUT: "null"
health/developer-portal: NO CHANGES DETECTED

And the same output with the SRC_REPO commented out:

Context: {
  "COMMIT_MESSAGE": "Update Synced Standards Docs from %SRC_REPO%",
  "DRY_RUN": true,
  "FILE_PATTERNS": [
    {}
  ],
  "GITHUB_SERVER": "github.com",
  "GITHUB_TOKEN": "<secret>",
  "GIT_EMAIL": "[email protected]",
  "GIT_USERNAME": "joelhess",
  "SKIP_CLEANUP": false,
  "SKIP_DELETE": false,
  "SKIP_REPLACE": false,
  "SRC_REPO": "health/development_standards",
  "SRC_ROOT": "/",
  "TARGET_REPOS": [
    "health/developer-portal"
  ],
  "TARGET_ROOT": "/developer-portal/standards/",
  "TMPDIR": "tmp-1638192990107"
}
health/development_standards: EXEC: "GIT_LFS_SKIP_SMUDGE=1 git clone --depth 1 https://***@github.com/health/development_standards.git tmp-1638192990107/health/development_standards" IN "./"
health/development_standards: OUTPUT: "null"
health/development_standards: FILE_PATTERNS [
  "/^general\\//"
]
health/development_standards: MATCHING FILES: [
  "general/coding_guidelines.md",
  "general/logging_guidelines.md",
  "general/readme_guidelines.md",
  "general/repository_guidelines.md",
  "general/testing_guidelines.md",
  "general/images/branch_add_rule.png",
  "general/images/branch_protection_rule.png",
  "general/images/repository_settings.png",
  "general/images/repository_settings_branches.png",
  "general/setups/branch_protection_rules_setup.md"
]
health/developer-portal: EXEC: "GIT_LFS_SKIP_SMUDGE=1 git clone --depth 1 https://***@github.com/health/developer-portal.git tmp-1638192990107/health/developer-portal" IN "./"
health/developer-portal: OUTPUT: "null"
health/developer-portal: FILE_PATTERNS [
  "/^general\\//"
]
health/developer-portal: MATCHING FILES: []
health/developer-portal: REMOVE FILES []
health/developer-portal: EXEC: "git status --porcelain" IN "tmp-1638192990107/health/developer-portal"
health/developer-portal: copy tmp-1638192990107/health/development_standards/general/coding_guidelines.md to tmp-1638192990107/health/developer-portal/developer-portal/standards/general/coding_guidelines.md
health/developer-portal: copy tmp-1638192990107/health/development_standards/general/logging_guidelines.md to tmp-1638192990107/health/developer-portal/developer-portal/standards/general/logging_guidelines.md
health/developer-portal: copy tmp-1638192990107/health/development_standards/general/readme_guidelines.md to tmp-1638192990107/health/developer-portal/developer-portal/standards/general/readme_guidelines.md
health/developer-portal: copy tmp-1638192990107/health/development_standards/general/repository_guidelines.md to tmp-1638192990107/health/developer-portal/developer-portal/standards/general/repository_guidelines.md
health/developer-portal: copy tmp-1638192990107/health/development_standards/general/testing_guidelines.md to tmp-1638192990107/health/developer-portal/developer-portal/standards/general/testing_guidelines.md
health/developer-portal: copy tmp-1638192990107/health/development_standards/general/images/branch_add_rule.png to tmp-1638192990107/health/developer-portal/developer-portal/standards/general/images/branch_add_rule.png
health/developer-portal: copy tmp-1638192990107/health/development_standards/general/images/branch_protection_rule.png to tmp-1638192990107/health/developer-portal/developer-portal/standards/general/images/branch_protection_rule.png
health/developer-portal: copy tmp-1638192990107/health/development_standards/general/images/repository_settings.png to tmp-1638192990107/health/developer-portal/developer-portal/standards/general/images/repository_settings.png
health/developer-portal: copy tmp-1638192990107/health/development_standards/general/images/repository_settings_branches.png to tmp-1638192990107/health/developer-portal/developer-portal/standards/general/images/repository_settings_branches.png
health/developer-portal: copy tmp-1638192990107/health/development_standards/general/setups/branch_protection_rules_setup.md to tmp-1638192990107/health/developer-portal/developer-portal/standards/general/setups/branch_protection_rules_setup.md
health/developer-portal: OUTPUT: "null"
health/developer-portal: NO CHANGES DETECTED

ghost avatar Nov 29 '21 14:11 ghost

could you please provide the workflow on trigger. GitHub Actions does sometimes work on "virtual-merge-branches" depending on the trigger. Mostly on pull-request runs. Maybe it has to do with that.

What happens if you use ^general instead of ^general/ for the FILE_PATTERNS?

adrianjost avatar Nov 29 '21 15:11 adrianjost

There is an open pull request on the branch, but the trigger is on push

name: Dev

on:  # yamllint disable-line rule:truthy
  push:
    branches-ignore:
      - 'main'
      - 'feature/**'
      - 'dependabot/**'
  workflow_dispatch:

No change in behavior after updating the file pattern.

ghost avatar Nov 29 '21 15:11 ghost

To be honest, I currently have no idea what the reason for this could be. I also haven't worked on this project for a while so it might could take some time to find and fix the issue. I will try to reproduce it this week.

If you discover any more insights, how/when this issue happens please let me know. :) A dedicated repo to clone where the bug is reproducible would also be very helpful.

adrianjost avatar Nov 29 '21 15:11 adrianjost