andstor / copycat-action Goto Github PK
View Code? Open in Web Editor NEW:copyright::octocat: GitHub Action for copying files to other repositories
Home Page: https://github.com/marketplace/actions/copycat-action
License: MIT License
:copyright::octocat: GitHub Action for copying files to other repositories
Home Page: https://github.com/marketplace/actions/copycat-action
License: MIT License
I've stumbled upon this action which seems to be exactly what I want. I'm working on a Project that uses ReactJS frontend + RoR backend. To keep things separate, we are using 2 separate repositories.
What I'm trying to do with CopyCat is automating the code transfer from frontend -> backend.
It seems to work as intended, but the problem is that CopyCat can't create a new branch on the target repository. This would make things much better for everyone. Maybe even make it create an automatic merge request?
I often have issue, if I rename, move folder, or delete a file. It's not removed from where I copy them to.
Is there a solution for this already? Else maybe a simple "clean" option could be added which deletes the folder first?
I was using the copycat action with the wrong token, that didn't had needed rights. The copying failed (file wasn't copied to the other repo), but the action terminated successfully. I would have expected the action to fail if the token hasn't got the rights needed.
I don't know if this is a bug, just wanted to leave this here, feel free to close this issue if this isn't of interest for you.
Hi!
I don't understand what is happening when I try to use copycat. This error appears
fatal: could not read Password for 'https://github.com': No such device or address
This is my code
name: Copy
on: push
jobs:
copy:
runs-on: ubuntu-latest
steps:
- name: Copy
uses: andstor/copycat-action@v3
with:
personal_token: ${{ secrets.PERSONAL_TOKEN }}
src_path: icn_export/
dst_path: /icn_export/
dst_owner: yceballost
dst_repo_name: yceballost.github.io
I did a personal token with a lot of permissions but doesn't work.
Thanks
If you are planning to implement the CopyCat GitHub Action in your GitHub Organization, be aware that one of the Org Admins should create a Personal Access Token in their GitHub account > Settings > Developer Settings > Personal access tokens
at https://github.com/settings/tokens and give the PAT admin:org
privileges. Then take that key and create a Org Secret called "PERSONAL_TOKEN"
Org Secrets do not implicitly have permissions associated with them. The organization administrator has permissions, not the org secret.
I spent quite a few hours trying to understand why the CopyCat GHA didn't copy files between my organization repos. I was trying to incorrectly use a Org Secret called "PERSONAL_TOKEN" which didn't have permissions.
I would be willing to submit a PR to improve the CopyCat README so my future self will know how to set up this GHA in GitHub Orgs.
Please consider adding an option to specify different COMMIT_MESSAGE in configuration
In our usecase, we would like to have an option to NOT overwrite the already existing files.
I would like to propose a new action option, called no_clobber
: false(default)/true
.
The interpretation of it would be: do not overwrite an existing file
If you are also interested in such feature, than I could start working on the PR.
In my use case I am using GitHub actions to build my Hugo site and would like to use Copycat Action to copy the compiled site directory's contents into the root of my GitHub pages repo. I have Copycat Action working, but it's copying the folder AND it's contents. It would be great if you could add an option to copy just the contents of a folder and not the folder itself. If you know a good workaround I'd also welcome that. I'm pretty new to GitHub Actions but it would definitely help out tremendously.
I would like to use clean only in a specific folder and keep the rest of the file structure intact.
Actual behaviour:
Is cleaning al my repo and copy just the src_path to dst_path
This is my code
name: Copy-New
on: push
jobs:
copy:
runs-on: ubuntu-latest
steps:
- name: Copy
uses: andstor/copycat-action@v3
with:
personal_token: ${{ secrets.copy_new }}
src_path: icn_export/
dst_path: ./
dst_owner: yceballost
dst_repo_name: yceballost.github.io
clean: true
Thanks
Hi! Firstly, thanks for this awesome tool.
I was trying to not get any of the files under the seeds dir to the mirror repo, or the README.md. I came up with this glob pattern that (should) work
{**/seeds/*,README.md}
Do you know why it isn't working?
Based on the documentation it seems this would be possible.
This doesn't seem to work though. Any suggestions? Each push I'd like to copy the README_files from the master to the gh-pages branch.
I tried this:
jobs:
copy:
runs-on: ubuntu-latest
steps:
- name: Copycat
uses: andstor/copycat-action@v3
with:
personal_token: ${{ secrets.PERSONAL_TOKEN }}
src_path: workflow-templates/extension-test.yml
dst_path: .github/workflows/test.yml
dst_owner: lens0021
dst_repo_name: Sanctions
dst_branch: master
commit_message: Update ".github/workflows/test.yml" from ${{ env.GITHUB_REPOSITORY }} (https://github.com/${{ env.GITHUB_REPOSITORY }}/commit/${{ env.GITHUB_SHA }})
(results Update ".github/workflows/test.yml" from (https://github.com//commit/)
)
and this:
commit_message: |
Update ".github/workflows/test.yml"
from "${{ env.GITHUB_REPOSITORY }}" (https://github.com/${{ env.GITHUB_REPOSITORY }}/commit/${{ env.GITHUB_SHA }}")
(results the same)
and this:
commit_message: |
Update ".github/workflows/test.yml"
from "${{ GITHUB_REPOSITORY }}" (https://github.com/${{ GITHUB_REPOSITORY }}/commit/${{ env.GITHUB_SHA }}")
(results "The workflow is not valid. .github/workflows/sync-extension-text.yml (Line: 26, Col: 27): Unrecognized named-value: 'GITHUB_REPOSITORY'. Located at position 1 within expression: GITHUB_REPOSITORY")
and this:
commit_message: |
Update ".github/workflows/test.yml"
from ${GITHUB_REPOSITORY} (https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA})
(results Update ".github/workflows/test.yml"
from ${GITHUB_REPOSITORY} (https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA})
)
commit_message: |
Update ".github/workflows/test.yml"
from "${GITHUB_REPOSITORY}" (https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA})")
(results: Update ".github/workflows/test.yml"
from "${GITHUB_REPOSITORY}" https://github.com/"${GITHUB_REPOSITORY}"/commit/"${GITHUB_SHA}"
)
commit_message: |
Update \".github/workflows/test.yml\"
from ${{ env.GITHUB_REPOSITORY }} (https://github.com/${{ env.GITHUB_REPOSITORY }}/commit/${{ env.GITHUB_SHA }})
(results: Update \".github/workflows/test.yml\"
from (https://github.com//commit/)
)
or this:
commit_message: Update ".github/workflows/test.yml"\n\nfrom ${{ env.GITHUB_REPOSITORY }} (https://github.com/${{ env.GITHUB_REPOSITORY }}/commit/${{ env.GITHUB_SHA }})
(results: Update ".github/workflows/test.yml"\n\nfrom (https://github.com//commit/)
)
What is the certain way to pass environment variables?
when i use workflow_call .the src repo is not i want. thinks!
Hi ,
Can we use github.token or secrets.github_token instead of personal access token ?
Regards,
It should be possible to only copy files passing a certain filter.
Hello,
we (@craigh and me) are trying to use this action, but weren't successful yet.
First we had some errors like fatal: could not read Password for 'https://***@github.com': No such device or address
which was probably caused by the token had not being setup correctly.
The current state is:
fatal: unable to access 'https://': Could not resolve host: info
Cloning 'zikula/core' failed
.We are a bit lost here and can only do "try and error". Can you give us an advice?
Automatically detecting the default branch name if the src_branchand/or
dst_branch` names are not provided by user.
Background:
A while back, GitHub started naming the master branch "main" by default. Since copycat-action
looks for a "master" branch by default, you have to explicitly provide branch names if you are using Github's new naming convention "main" for your default branch. Obviously if you are already using custom branch names, you have to explicitly specify them.
Instead of assuming each default branch name is always "master", we need to automatically detect the name to explicitly use it to clone the src and dst repos.
I believe below is a reliable way to get the default branch name.
git remote show upstream | grep "HEAD branch" | sed 's/.*: //'
I will work on a PR to test this out.
Hi there,
Thank you for the great action, I use it quite a bit.
I'm having problems with the deletion of particular folders when merging into a repo.
The target repository has a directory structure like so:
content
│
└───client-1
│ └───project-1
│ │ index.html
│ │ ...
│ └───project-2
│ │ index.html
│ │ ...
└───client-2
│ └───project-1
│ │ index.html
│ │ ...
I copy the source of public
(source repo) to the client's folder. However, if there are multiple projects
, it will delete them all.
For example, if project-1
already resides in the client-1
folder and project-2
gets copied, it will delete project-1
.
I'm using the clean
flag, I'm not sure if that has anything to do with it? Although I do want to remove the project folder before copying.
# Step 7: Copies the public folder to the staging repo.
- name: Copy
uses: andstor/copycat-action@v3
with:
personal_token: ${{ secrets.GIT_TOKEN }}
src_path: public/.
src_branch: staging
dst_path: /content/client-1/example-project
dst_owner: xxxx
dst_repo_name: xxxx
clean: true
commit_message: Update /content/client-1/example-project
Thanks for your help in advance.
Hi! I know this package has a commit_message
option. But I'd like to have that option set automatically based on each commit on the src repo. AFAIK, this could be a little bit tricky to implement since I think this action just copies all the content in the src repository to the destination repo, without taking into account each commit's message content.
I run scripts npm install
and npm run build
and a new folder called build would be created in the github action like this :
steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} cache: "npm" - run: npm install - run: CI=false npm run build - name: Copy uses: andstor/copycat-action@v3 with: personal_token: ${{ secrets.PERSONAL_TOKEN }} src_path: /build dst_owner: name dst_repo_name: page clean: true
But it doesn't recognize the newly created folder and says it doesn't exist .
I'm getting the following error when I try to use this action.
##[error]Container action is only supported on Linux
I assume this is because my GitHub agent is running Windows.
Is there any plans to make this Windows friendly?
Can't seem to set multiple paths as exceptions.
This may just be the expected behaviour of the action still, I figured I'd place an issue just in case I'm missing something.
The docs implied that we could do so and I think the glob pattern is correct for excluding everything under controller and view (these are not root folders).
I am using this config:
on:
push:
branches: [ production ]
jobs:
copy:
runs-on: ubuntu-latest
steps:
- name: Copycat
uses: andstor/copycat-action@v3
with:
personal_token: ${{ secrets.GH_TOKEN }}
src_path: /admin
dst_path: /opver3/
dst_owner: josesoaresif
dst_repo_name: test01
dst_branch: main
src_branch: production
commit_message: "tests: test commit message"
username: josesoaresif
email: [email protected]
clean: true
exclude: "**/{controller,view}/**/*"
works great if you change the exclude to a single folder:
exclude: "/controller//*"
I have this job here
:
copy_packages:
runs-on: ubuntu-latest
steps:
- name: Copy config/packages/*
uses: andstor/copycat-action@v2
with:
personal_token: ${{ secrets.COPY_DIST_TOKEN }}
src_path: /config/packages
src_filter: '!/test/*|!/dev/*'
dst_path: /config
dst_owner: zikula
dst_repo_name: distribution
I am trying to get the copy to ignore /config/packages/dev
and /config/packages/test
but clearly the glob pattern is wrong because it isn't working. Can you help?
As title says.
Also, I tried to use exclude to avoid copying .github/workflows/ but that also doesn't seem to work.
Otherwise this is an awesome action!
Hello,
For some reason I am not able to get the exclude to work. It is copying the wofklow action itself in to the destination repository. I am sure I am just not doing the globs right. Any help on my config would help:
- name: Copy
uses: andstor/copycat-action@v3
with:
personal_token: ${{ secrets.PERSONAL_TOKEN }}
src_path: /.
dst_path: /site1/
dst_owner: woodman231
dst_repo_name: woodman231.github.io
exclude: /.github/*
clean: true
I even tried exclude: */.github/* but then it tells me that is an invalid token and won't allow me to save the yml file.
Is there any way that we can copy files/folders from the the GitHub Workspace into one of the repo's branches?
dst_repo should take a destination repository in the form of "owner/repo_name" so that this action can be used both by specifying owner and name separately (with a / in between) and by specifying directly owner and repo_name together, for example by using ${{ github.repository }}
This is particularly needed since github does not provide a way to access repo name (such as github.repository.name) despite the fact that they provide github.repository_owner and github.repository
I expect the GitHub action to sync directory in the source repository with the directory in the target repository. Whether I add a new file, update an existing file or delete a file.
copycat-action GitHub action works fine if I add a new file or update an existing file. However, when I delete a file (in the source repository), it does not delete the file in the target repository.
How can I truly sync both the directories in the source and target repository? Thanks.
By making the user.name and user.email configurable, one might set a bot account as the author of the commits.
Hello, I cannot get it to work. What I am trying to accomplish is copying the changelog from one repo into another, within an organization. I have ensured that my PAT does not have a space in it, and I have tried both ${{ secrets.GITHUB_TOKEN }}
, and my PAT with all permissions granted.
Any ideas?
I have repos with LFS documents, how do include those files?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.