Giter VIP home page Giter VIP logo

copycat-action's Introduction

Hi there, I'm André Storhaug 👋

/ˈɑːndɹe ˈstoˑɹhaːg/

I am a PhD student 🎓 at the Norwegian University of Science and Technology (NTNU), pursuing a Doctor of Philosophy (PhD) degree in Computer Science.

📫 How to reach me:

copycat-action's People

Contributors

andstor avatar casperhr avatar henryzt avatar markcheret avatar ricardomonteirosimoes avatar rywall avatar yceballost avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

copycat-action's Issues

Cannot find newly created folder called build

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 .

Deleting contents of parent folder

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.

Permission error

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

[FEATURE] dst_repo_owner and dst_repo_name should be merged in dst_repo

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

Creating a new Branch and making a MR to Master?

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?

Action terminates successfully despite failure

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.

copycat-issue

Can't get it working

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:

  1. I created a personal access token (at my account) and added it as secret to the repository which runs the action (owned by an organisation).
  2. The workflow looks like this: https://github.com/zikula/core/blob/master/.github/workflows/copy-to-dist.yml
  3. The action execution can be seen here: https://github.com/zikula/core/runs/492015952
  4. Current error message: 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.

Automatically detecting the default branch name if the src_branchand/ordst_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.

Feature proposal: --no-clobber option for the copy command

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.

Personal Access Token in a Organization Secret "PERSONAL_TOKEN"

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.

REPOSITORY IS DEAD?

I Created a Competitor called Git Get Cloned Action

Why?

  • code lacked documentation
  • I realized most of the code is procedural and kept it that way
  • there were several features missing from copycat that I wanted to add and felt from scratch with better documentation was the way to go
  • development has stalled at 2021

Cleaning a directory

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

Can´t exclude multiple folders.

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//*"

Exclude pattern not working

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?

##[error]Container action is only supported on Linux

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?

Add option to copy just folder contents instead of folder AND contents

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.

Copy each `commit_message` from source folder's git history

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.

how to ignore some directories?

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?

Add option to delete all before push

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?

Exclude not working for me

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.

How to use env variables in COMMIT_MESSAGE?

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?

Removes files in the Destination 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.