Closed sunn-e closed 2 years ago
This feature Added in 2.0
hi @varunsridharan did you test this feature? Actually for me it does not work, when copying a folder. It always says:
terraform=.github/workflows
✔ xxx/workflows/terraform => .github/workflows
Error: 🛑️ Unable To Copy File.
Error: no such file or directory: /home/runner/work/yyy/yyy/xxx/workflows/terraform/\.
I have a folder with subfolder structure and files that shall be copied by this inside the workflows folder (I do use composite
feature of actions inside here)
@wagnst can you please provide your workflow yaml file ?? Just the workflow copy action's yml will do
@varunsridharan sure, please see here:
where terraform
is a folder inside the <ORG name>/workflows
folder (which is in the ROOT of the repo). It shall go into .github/workflows
. I see in the message its detected correctly, but it seems the cp
command actually gives the error output.
terraform
folder has 4 subfolders, where in each subfolder there is one file each called action.yml
. Its an implementation using the new actions composite
feature that i would like to sync as well. For composite check here: https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action
name: Workflow Sync for landingzone git repositories
on:
push:
branches:
- master
paths:
- '.github/workflows/**'
- '<ORG name>/**'
schedule:
- cron: "0 0 * * *" # Run at the end of every day
workflow_dispatch:
env:
DRY_RUN: false
TF_WORKSPACE_REPOSITORIES: |
<ORG name>/base-landingzone
TF_WORKSPACE_WORKFLOW_FILES: |
tf-workspace-master.yml
tf-workspace-pr.yml
tf-workspace-editorconfig=.editorconfig
tf-workspace-gitignore=.gitignore
tf-workspace-CODEOWNERS=.github/CODEOWNERS
pull_request_template.md=.github/pull_request_template.md
dependabot.yml=.github/dependabot.yml
terraform=.github/workflows
jobs:
github-repo-sync-tf-workspaces:
name: "File sync for tf workspace repositories"
runs-on: ubuntu-latest
steps:
- name: Fetching Local Repository
uses: actions/checkout@master
- name: Running Workflow Sync
uses: varunsridharan/action-github-workflow-sync@main
with:
DRY_RUN: ${{ env.DRY_RUN }}
REPOSITORIES: ${{ env.TF_WORKSPACE_REPOSITORIES }}
WORKFLOW_FILES: ${{ env.TF_WORKSPACE_WORKFLOW_FILES }}
GITHUB_TOKEN: ${{ secrets.SYNC_TOKEN }}
PULL_REQUEST: true
COMMIT_MESSAGE: "Sync of files from <ORG name>/base-landingzone"
@wagnst i am confused seeing your config. can you please tell me exactly where terraform folder is located ?
hey @varunsridharan, thanks!
<repo root>
- /<github org name>
- /workflows
- /terraform
- /subfolder1
- action.yml
- /subfolder2
- action.yml
And terraform
folder (with subfolders, etc.) it sould be copied to another repo into: .github/workflows
Does this help?
@wagnst thanks
the path should be like this ./<github org name>/workflows/terraform
env:
DRY_RUN: false
TF_WORKSPACE_REPOSITORIES: |
<ORG name>/base-landingzone
TF_WORKSPACE_WORKFLOW_FILES: |
tf-workspace-master.yml
tf-workspace-pr.yml
tf-workspace-editorconfig=.editorconfig
tf-workspace-gitignore=.gitignore
tf-workspace-CODEOWNERS=.github/CODEOWNERS
pull_request_template.md=.github/pull_request_template.md
dependabot.yml=.github/dependabot.yml
- terraform=.github/workflows
+ ./<github org name>/workflows/terraform=.github/workflows
@varunsridharan i also tried that. Also now again, it does not work:
./<github org name>/workflows/terraform=.github/workflows
✔ <github org name>/workflows/terraform => .github/workflows
Error: 🛑️ Unable To Copy File.
Error: no such file or directory: /home/runner/work/<dest repo>/<dest repo>/<github org name>/workflows/terraform/\.
Config for that run is:
TF_WORKSPACE_WORKFLOW_FILES: |
./<github org name>/workflows/terraform=.github/workflows
@wagnst sorry about that. I will try to replicate the same in my test env and update you on this. in the mean time if you could share the repo and the full action log i might guess what exactly happening .
@varunsridharan thanks! What exactly else do you require? Other output relevant for that I cannot find in the logs. Unfortunately i cannot share the repo with you in full as it contains private information. But let me know what exactly I can test to help figure out / debug the issue! I think you can also easily reproduce it
Same issue. I suspect the problem is at path/\.
which seems to be coming from https://github.com/varunsridharan/actions-js-toolkit/blob/main/src/path/index.js#L24 -- my guess is that the extra \
is breaking for actions/io, even though it works fine for cp. PR incoming, which makes it work but throws an error without the trailing /
, at least on source. It works with or without though
Tree
$ tree
.
├── github-actions
│ └── k8s
│ ├── kustomize-lint.yaml
│ └── skaffold-deploy.yaml
└── README.md
Sample (working, no slash):
# github-actions/k8s/=.github/workflows/ # << this works without errors
Error: 🛑️ Unable To Find Source File !
github-actions/k8s=.github/workflows # << this throws an error with the incoming PR, but still works
✔ github-actions/k8s => .github/workflows
✔ [file-sync-6-master-1622566039 59d9344] 💬 - Files Synced | Runner ID : 6 | ⚡ Triggered By FATMAP/github-file-sync
2 files changed, 135 insertions(+)
create mode 100644 .github/workflows/k8s/kustomize-lint.yaml
create mode 100644 .github/workflows/k8s/skaffold-deploy.yaml
Broken
github-actions/k8s=.github/workflows
✔ github-actions/k8s => .github/workflows
Error: 🛑️ Unable To Copy File.
Error: no such file or directory: /home/runner/work/github-file-sync/github-file-sync/github-actions/k8s/\. # << perhaps the extra \?
No changes detected
GitHubPredefined Functions For Github Actions NodeJS. Contribute to varunsridharan/actions-js-toolkit development by creating an account on GitHub.
I tried passing the path as traditional "path/to/folder/*" to get every file in a folder but it does not work. This feature can come handy when you have many files in source folder.