Git Product home page Git Product logo

copy_file_to_another_repo_action's People

Contributors

aefraimidis avatar bboles avatar dmnemec avatar drakos74 avatar exponentactivity avatar filipepiresg avatar haojianzong avatar lukasklein avatar maliksteam avatar mindaugaslaganeckas avatar seemiller avatar splitice avatar sta-szek avatar walterddr 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  avatar

copy_file_to_another_repo_action's Issues

File is put in a dir with the same name of the file

When I run this on, say "fmc.js", and its to place the file in the "extension/scripts" dir, the file is placed in "extension/scripts/fmc.js/fmc.js". The first fmc.js is a folder. Did I set this up wrong? Here's the code:

        uses: dmnemec/copy_file_to_another_repo_action@main
        env:
          API_TOKEN_GITHUB: ${{ secrets.FILE_SHARING_PAT }}
        with:
          source_file: "fmc.js"
          destination_repo: "exampleperson/example"
          destination_folder: "extension/scripts"
          user_email: "[email protected]"
          user_name: "exampleperson"
          commit_message: "๐Ÿค– Update Script"

Fails to copy to a private repo.

I get: remote: Repository not found. But the repo can be accessed via my organization. I even forked this repo to put it inside my org thinking that might do the trick and got nothing. I've set the API_TOKEN_GITHUB, the path to the repo is correct but still it doesn't work. I feel like there's something simple I'm missing here. It used to work and just stopped one day.. one day well before I started this job :) If anyone has any advice here I'd love to have it. Thanks!

When using multiple files in a matrix, the first copy will work... The next one will not because the source changed

The use case can be seen here:

https://github.com/JoseRodrigues443/Awesome-CV/blob/master/.github/workflows/main.yml

The build error:


Pushing git commit
+ git push -u origin HEAD:main
To https://github.com/JoseRodrigues443/joserodrigues443.github.io.git
 ! [rejected]        HEAD -> main (fetch first)
error: failed to push some refs to 'https://github.com/JoseRodrigues443/joserodrigues443.github.io.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing


The cause

Basically on a matrix, I selected 3 files to run the dmnemec/copy_file_to_another_repo_action action.

One is pushed, success, the second is pushed, fails because the origin changed... The action could make a git pull to make sure the push will succeed.

If the merge fails, ok let it fail.

How to use SSH_DEPLOY_KEY instead of API_TOKEN_GITHUB

Ideally I would prefer to use a SSH deploy key instead of a Personal Access Token. Does this action currently support SSH deploy keys? When I tried using one I got this error: github fatal: Authentication failed for.

URL using bad/illegal format or missing URL

I try to use this action for my GitHub organization.
So for destination_repo, I entered 'ORGANIZATION_NAME/REPO_NAME'.
However, I then get the following error:
fatal: unable to access 'https:///ORGANIZATION_NAME/REPO_NAME.git/': URL using bad/illegal format or missing URL

Action fails after recent change to entrypoint.sh

I have a number of workflows that use this action and they're failing with this error after the recent change to entrypoint.sh:

Cloning into '/tmp/tmp.icEILo'...
+ echo 'Copying contents to git repo'
Copying contents to git repo
+ mkdir -p /tmp/tmp.icEILo/
+ rsync -avrh CHANGELIST.md /tmp/tmp.icEILo/
/entrypoint.sh: line 27: rsync: not found

destination_branch confusing if your repo still uses master

https://github.com/dmnemec/copy_file_to_another_repo_action/blob/main/entrypoint.sh#L12:L34

If you have master branch and not main in your repo, then you must specify destination_branch: "master" in your workflow for git clone, and then use destination_branch_create to specify a different target branch if desired.

This was confusing because of the names destination_branch and destination_branch_create. The latter is definitely only a destination branch, but the former is sometimes a destination and always a source.

commit_message does not work with version 1.0.4

this warning printed out in the console

Unexpected input(s) 'commit_message', valid inputs are ['entryPoint', 'args', 'source_file', 'destination_repo', 'destination_folder', 'user_email', 'user_name', 'destination_branch']

Create branch if not existent, else update

I always want to copy my file to a specific branch.
If I use the destination_branch option, the action throws an error when the given branch does not exist.
Else, if I use the destination_branch_create, the action creates the branch if it doesn't exist, but fails if it exists instead of updating it.
There are of course ways to check if the branch exists and chose the right option based on this, but it would be nicer if the default would just be to create a branch if it doesn't exist and to update if it exists (like the copycat action does).

Can we give multiple files to copy to different destinations?

I am using this github action, It is copying one source file to one destination directory, Can we give multiple sources and destinations?
My yml file:

- name: Pushes test file
uses: dmnemec/copy_file_to_another_repo_action@main
env:
  API_TOKEN_GITHUB: ${{ secrets.TOKEN }}
with:
  source_file: 'test/transfer/'
  destination_repo: 'repo name'
  destination_folder: 'src/destination/'
  user_email: 'email'
  user_name: 'name'
  commit_message: 'A custom message for the commit'

License change Apache 2.0 > MIT

Would it be possible to change the license? I forked this action and changed it to be specificly used with jekyll and github pages, possibly under MIT. I know i can do it but i'd still have to keep Apache license file and list changes which becomes tedious after a while.

Authorization fails when 2FA is enabled

+ '[' -z <output-file-path> ]
+ '[' -z github.com ]
+ '[' -z  ]
+ INPUT_DESTINATION_BRANCH=main
+ OUTPUT_BRANCH=main
Cloning destination git repository
+ mktemp -d
+ CLONE_DIR=/tmp/tmp.fmApGh
+ echo 'Cloning destination git repository'
+ git config --global user.email <user-email>
+ git config --global user.name <user-name>
+ git clone --single-branch --branch main ***github.com/<org-name>/<repo-name>.git /tmp/tmp.fmApGh
Cloning into '/tmp/tmp.fmApGh'...
warning: redirecting to https://github.com/<org-name>/<repo-name>.git/
+ '[' '!' -z  ]
+ DEST_COPY=/tmp/tmp.fmApGh/<file-destination>
+ echo 'Copying contents to git repo'
Copying contents to git repo
+ mkdir -p /tmp/tmp.fmApGh/<file-destination>
+ '[' -z  ]
+ cp -R <output-file-path> /tmp/tmp.fmApGh/<file-destination>
+ cd /tmp/tmp.fmApGh
+ '[' '!' -z  ]
Adding git commit
+ '[' -z 'Commit <file-to-be-copied>' ]
+ echo 'Adding git commit'
+ git add .
+ git status
+ grep -q 'Changes to be committed'
+ git commit --message 'Commit changes'
[main 8a84aa4] Commit <file-to-be-copied>
+ echo 'Pushing git commit'
+ git push -u origin HEAD:main
 1 file changed, 36 insertions(+)
 create mode 100644 <file-destination>
Pushing git commit
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/<org-name>/<repo-name>.git/

I get above error message while trying to push a file to destination repo in same org. The user has write access to both repositories and secrets(PAT, email, username) are added on both sides. Excluding 'delete', PAT has all access.
Can you let me know if I'm missing something in configuration or this action can't be used when 2FA is enabled in organisation settings.

Thanks!

How to copy full branch content to another repository ?

Hi ,

I'm trying to copy all files & folders from 'source repo branch' to 'destination repo branch'.
Can you suggest what should i pass input value in 'inputs.SOURCE_PATH' ?

i've tried as using "./" , "/." , "/* " but it fails

        uses: dmnemec/copy_file_to_another_repo_action@main
        env:
          API_TOKEN_GITHUB: ${{ secrets.GIT_TOKEN }}
        with:
          source_file: ${{ inputs.SOURCE_PATH }}
          destination_repo: ${{ inputs.destination_repo }} #owner/repo_name
          destination_branch: ATOM-updates #[optional] A branch to be created with this commit, defaults to commiting in destination_branch
          #destination_folder: ${{ inputs.SOURCE_PATH }}
          user_email: ${{ inputs.user_email }}
          user_name: ${{ inputs.user_name }}

Authentication fails

Hi team,

I've set up logins using PAT a while ago. Now, I'm trying to use your GitHub action to push files from a private repo doul to another private one doul-bin, but getting an error fatal: Authentication failed for 'https://github.com/aiurovet/doul-bin.git/':

      - name: Push the output to bin repository
        uses: dmnemec/copy_file_to_another_repo_action@main
        env:
          API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
        with:
          source_file: 'bin/${{ runner.os }}'
          destination_repo: 'aiurovet/doul-bin'
          destination_folder: '${{ runner.os }}'
          user_email: 'aiurovet@***'
          user_name: 'aiurovet'

So what am I doing wrong?

Please note also that the source project uses master branch, but the destination one uses main. Could this be a potential source of trouble? What does INPUT_DESTINATION_BRANCH mean, and how does input differ from source?

Here is the full output:

/usr/bin/docker run --name a33c192b39edaa4b34bf0b872c503d729e501_dfb933 --label 8a33c1 --workdir /github/workspace --rm -e OSTYPE -e PUB_CACHE -e API_TOKEN_GITHUB -e INPUT_SOURCE_FILE -e INPUT_DESTINATION_REPO -e INPUT_DESTINATION_FOLDER -e INPUT_USER_EMAIL -e INPUT_USER_NAME -e INPUT_DESTINATION_BRANCH -e INPUT_DESTINATION_BRANCH_CREATE -e INPUT_COMMIT_MESSAGE -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/doul/doul":"/github/workspace" 8a33c1:92b39edaa4b34bf0b872c503d729e501  "" "" "" "" "" "" ""
+ '[' -z bin/Linux ]
+ '[' -z  ]
+ INPUT_DESTINATION_BRANCH=main
+ OUTPUT_BRANCH=main
+ mktemp -d
+ CLONE_DIR=/tmp/tmp.fEPhlB
+ echo 'Cloning destination git repository'
+ git config --global user.email [email protected]
Cloning destination git repository
+ git config --global user.name aiurovet
+ git clone --single-branch --branch main ***github.com/aiurovet/doul-bin.git /tmp/tmp.fEPhlB
Cloning into '/tmp/tmp.fEPhlB'...
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/aiurovet/doul-bin.git/'

workflow not using ssh

Hello, I'v currently configured all my repositories to use ssh, but when I run the workflow, it still uses the 'https://' form. That results in this error
remote: Support for password authentication was removed on August 13, 2021. remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about- remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication. fatal: Authentication failed for 'https://github.com/princemuel/invoice-web-app.git/'

How do I resolve it? Thanks

How to use a generated file?

I couldn't get this action to work with a generated file. I got this action to work using a generated file, but it destroys the destination repository.

I don't want to destroy my destination repository so I'm trying to adapt this action you've created to be able to use a generated file. This is the code I have so far, but it still can't find the generated file.

If you have the time - do you know what's missing?

Doesn't post to root folder.

Trying to post files from my common settings repo so another repo which should have the same files and structure and its not posting to root. instead its putting it in the 'site' folder.

name: File sync

on: push

jobs:
  copy-file:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Pushes test file
        uses: dmnemec/copy_file_to_another_repo_action@main
        env:
          API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
        with:
          source_file: '.git-sync/site/*.*'
          user_name: 'Bearsampp'
          user_email: '[email protected]'
          destination_repo: 'Bearsampp/website'
          #destination_folder: '/'
          destination_branch: 'main'

image

I've tried source_file: '.git-sync/site/*.*' in many configurations

Add retry with pull just before pushing to avoid errors

Hi,
First of all, thanks for the great extension, Its really helpful.

I'm running into issues when using this action to push into the main branch of another repo.
The other repo has a pretty high commit rate, so every once in while i get a:

error: failed to push some refs to 'github.com:____.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details

I think adding a git pull right before the commit, or after with some merge or rebase flag could be very useful.
We could add a retry count option, and maybe another option for custom git pull flags.

I have the time and willing to open a PR. Is this something agree with and want to add?

Make action work for github apps

For github apps, the action fails due to the http API call for checkout clone.

+ git clone --single-branch --branch $INPUT_DESTINATION_BRANCH "https://[email protected]/$INPUT_DESTINATION_REPO.git" /tmp/tmp.iCiMJM
Cloning into '/tmp/tmp.iCiMJM'...
fatal: could not read Password for 'https://***@github.com': No such device or address

According to this : https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/#http-based-git-access-by-an-installation
The http call needs to be adjusted.

This change will allow the action to be used both with personal access token and temporary installation token .
And will enable a broader range of users to make use of this action.

Source folder in root to destination folder in root issue

If both source & destination folders are in the root, the destination folder creates a sub folder
with the root folders name.
source_file: "Fiddler2"
destination_folder: "Fiddler2"
As "destination_folder" is supposed to be required: false, removing that entry produces an error:
fatal: not a git repository (or any of the parent directories): .git
Leaving it intact you get this faulty path in the destination folder with an empty sub folder:
image

Fails on cp: target '/tmp/tmp.ahLafm/monorepo-builder' is not a directory

I'm trying to publish full directory (not just single file) to remote repository.

On this Github Actions setup: https://github.com/symplify/symplify/pull/2437/files#diff-c065bcdb0c59642b8340c2b26d8ab09cc27d3ee7859a3575f916a6497cb7a17fR39

            -
                name: Push To Remote Repository
                uses: dmnemec/[email protected]
                env:
                    API_TOKEN_GITHUB: ${{ secrets.ACCESS_TOKEN }}
                with:
                    source_file: packages-scoped/${{ matrix.scoped_package }}
                    destination_repo: symplify/${{ matrix.scoped_package }}-prefixed
                    user_email: '[email protected]'
                    user_name: 'TomasVotruba'

I got this fail:
https://github.com/symplify/symplify/pull/2437/checks?check_run_id=1341352063

image


Any tips what I'm doing wrong?

Thank you

No space before ']'

Here, it can be seen that there is no space between the final " and ]. It won't parse as expected, there needs to be a space

"commit_message" is missing

Hi,

thank you for this package. It might be exactly what I need for package splitting.

I have a trouble with missing "commit_message":

image

Do I have a typo or something?

Urgent: Causing conflict with workflows running simultaneously

hello @dmnemec ,

this works great when there is a single workflow going on
However, in my case there are 2 workflows running simulataneously and pushing different files to same repo
It fails saying there is another git operation going on and some of the work is not present locally - and asks me to do a pull before push.

how do I use this action in this case.

error: RPC failed; HTTP 408 curl 18 HTTP/2 stream 7 was reset

Thanks for this action!

My workflow has been working for ~2 years. Last week, this error appeared when I try to move a 2.1MB file to another repo. The issue and work-around are discussed here.

tldr; This action needs the following added:

git config --global http.version HTTP/1.1

I'm currently using this fork that has the fix work-around in place.

PR #78 looks like it is attempting to fix the same issue.

Authentication failed with 2FA enabled organisation

+ '[' -z <output-file-path> ]
+ '[' -z github.com ]
+ '[' -z  ]
+ INPUT_DESTINATION_BRANCH=main
+ OUTPUT_BRANCH=main
Cloning destination git repository
+ mktemp -d
+ CLONE_DIR=/tmp/tmp.fmApGh
+ echo 'Cloning destination git repository'
+ git config --global user.email <user-email>
+ git config --global user.name <user-name>
+ git clone --single-branch --branch main ***github.com/<org-name>/<repo-name>.git /tmp/tmp.fmApGh
Cloning into '/tmp/tmp.fmApGh'...
warning: redirecting to https://github.com/<org-name>/<repo-name>.git/
+ '[' '!' -z  ]
+ DEST_COPY=/tmp/tmp.fmApGh/<file-destination>
+ echo 'Copying contents to git repo'
Copying contents to git repo
+ mkdir -p /tmp/tmp.fmApGh/<file-destination>
+ '[' -z  ]
+ cp -R <output-file-path> /tmp/tmp.fmApGh/<file-destination>
+ cd /tmp/tmp.fmApGh
+ '[' '!' -z  ]
Adding git commit
+ '[' -z 'Commit <file-to-be-copied>' ]
+ echo 'Adding git commit'
+ git add .
+ git status
+ grep -q 'Changes to be committed'
+ git commit --message 'Commit changes'
[main 8a84aa4] Commit <file-to-be-copied>
+ echo 'Pushing git commit'
+ git push -u origin HEAD:main
 1 file changed, 36 insertions(+)
 create mode 100644 <file-destination>
Pushing git commit
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/<org-name>/<repo-name>.git/

I get above error message while trying to push a file to destination repo in same org. The user has write access to both repositories and secrets(PAT, email, username) are added on both sides. Excluding 'delete', PAT has all access.
Can you let me know if I'm missing something in configuration or this action can't be used when 2FA is enabled in organisation settings.

Thanks!

fatal: could not read Username for 'https://github.com': No such device or address

With this code I'm getting this output (error at the bottom):

+ '[' -z practice_at_root.yml ]
+ '[' -z main ]
Cloning destination git repository
+ mktemp -d
+ CLONE_DIR=/tmp/tmp.PKilAJ
+ echo 'Cloning destination git repository'
+ git config --global user.email [email protected]
+ git config --global user.name plocket
+ git clone --single-branch --branch main https://@github.com/plocket/tests-github-action-push.git /tmp/tmp.PKilAJ
Cloning into '/tmp/tmp.PKilAJ'...
warning: redirecting to https://github.com/plocket/tests-github-action-push.git/
+ echo 'Copying contents to git repo'
+ mkdir -p /tmp/tmp.PKilAJ/practice-dir
Copying contents to git repo
+ cp -R practice_at_root.yml /tmp/tmp.PKilAJ/practice-dir
+ cd /tmp/tmp.PKilAJ
+ echo 'Adding git commit'
+ git add .
Adding git commit
+ git status
+ grep -q 'Changes to be committed'
+ git commit --message 'Update from https://github.com/plocket/a-repo/commit/8844b603381727d3d5258afcfde1fd6352f64ed0'
[main b27bc7f] Update from https://github.com/plocket/a-repo/commit/8844b603381727d3d5258afcfde1fd6352f64ed0
 1 file changed, 1 insertion(+)
 create mode 100644 practice-dir/practice_at_root.yml
+ echo 'Pushing git commit'
Pushing git commit
+ git push origin main
fatal: could not read Username for 'https://github.com': No such device or address

fatal: unable to access '...': URL using bad/illegal format or missing URL

I use this action like this:

    uses: dmnemec/copy_file_to_another_repo_action@main
    env:
      API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
    with:
      source_file: '${{ steps.repoName.outputs.repoName }}.md'
      destination_repo: 'organization/repoName'
      user_email: 'myEmail'
      user_name: 'BuddiesTV'
      commit_message: 'Update Version'

& i receive this error fatal: unable to access 'https://github.com/'organization/repoName.git/': URL using bad/illegal format or missing URL

Existing file overwrite

Is an existing file (in destination repo) is being overwritten during copy or action will fail in such a case?

Coping old file

Hi i have form where i submit and create file in repo and push to another repository. This code works fine but it wont copy current file that i ran.it will copy old file .any idea where is the issue ?
name: CI
on:
workflow_dispatch:
inputs:
backup_retentiondays:
description: 'Backup retention days.Supported values are between 7 and 35 days'
required: false
georedundantbackupenable:
type: choice
description: 'Enable georedundant backup '
options:
- false
- true
ha_enable:
type: choice
description: 'Enable high availability'
options:
- no
- yes
location:
description: 'Specifies the supported Azure location where the resource exists'
required: true
password_changedays:
description: 'Frequency of postgres admin password rotation'
required: true
postgres_admin_login:
description: 'The username for the administrator login'
required: true
postgres_servername:
description: 'Postgres Server Name'
required: true
postgres_version:
type: choice
description: "postgres version to deploy. Available options are 11 to 13. Default is 13"
options:
- 13
- 12
- 11
jobs:
create-vars:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Updating my.auto.tfvars variables
run: |
touch vars/${{ github.event.inputs.postgres_servername }}.auto.tfvars
echo "backup_retentiondays = "${{ github.event.inputs.backup_retentiondays }}"" > vars/${{ github.event.inputs.postgres_servername }}.auto.tfvars
echo "georedundantbackupenabled = "${{ github.event.inputs.georedundantbackupenable }}"" >> vars/${{ github.event.inputs.postgres_servername }}.auto.tfvars
echo "ha_enable = "${{ github.event.inputs.ha_enable }}"" >> vars/${{ github.event.inputs.postgres_servername }}.auto.tfvars
echo "location = "${{ github.event.inputs.location }}"" >> vars/${{ github.event.inputs.postgres_servername }}.auto.tfvars
echo "password_changedays = "${{ github.event.inputs.password_changedays }}"" >> vars/${{ github.event.inputs.postgres_servername }}.auto.tfvars
echo "postgres_admin_login = "${{ github.event.inputs.postgres_admin_login }}"" >> vars/${{ github.event.inputs.postgres_servername }}.auto.tfvars
echo "postgres_servername = "${{ github.event.inputs.postgres_servername }}"" >> vars/${{ github.event.inputs.postgres_servername }}.auto.tfvars
echo "postgres_version = "${{ github.event.inputs.postgres_version }}"" >> vars/${{ github.event.inputs.postgres_servername }}.auto.tfvars
cat vars/${{ github.event.inputs.postgres_servername }}.auto.tfvars
git add vars/${{ github.event.inputs.postgres_servername }}.auto.tfvars
git commit -m "Added vars/${{ github.event.inputs.postgres_servername }}.auto.tfvars file in vars folder"
git push origin
- uses: actions/checkout@v2
with:
fetch-depth: 0
repository: 'PostgresRepoCreation'
- name: cat tfvars
run: |
cat 'vars/${{ github.event.inputs.postgres_servername }}.auto.tfvars'
- name: Pushes test file
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source_file: 'vars/${{ github.event.inputs.postgres_servername }}.auto.tfvars'
destination_repo: 'testgithubactionsrepo'
destination_folder: 'test-dir'
user_email: '[email protected]'
user_name: 'naresh'

Authentication differences on closed pull request vs workflow dispatch

I've implemented this action in our team's workflow: https://github.com/SIMPLE-AstroDB/SIMPLE-db/blob/main/.github/workflows/gen-db.yml

The interesting aspect of it, though, is that we've had no issues when our team uses the workflow_dispatch to run the action. However, when run via a pull_request we get errors that the user is not authenticated.

Here is an example of a failed push run via the pull request: https://github.com/SIMPLE-AstroDB/SIMPLE-db/runs/3308980772?check_suite_focus=true#step:7:19
And here is the same commit re-run successfully via workflow_dispatch: https://github.com/SIMPLE-AstroDB/SIMPLE-db/runs/3309106993?check_suite_focus=true#step:7:19

The only difference I can spot in that is that the failed version has a warning: redirecting to https://... message in line 24, could that be enough for it to fail? Any ideas on how to better debug this?

Setting up to use default Github env. variables

Instead of having to hard code the destination_repo, it might be ideal if this can take default GitHub env. variables.
Please see below.
This could come in handy, especially if this yml is to be used as a template for multiple repos.

...
    - name: Pushes output to destination repository
      uses: dmnemec/copy_file_to_another_repo_action@main 
      env:
        API_TOKEN_GITHUB: ${{ secrets.GITHUB_TOKEN }}
      with:
        source_file: 'fromFolder/'
        destination_repo: '${GITHUB_REPOSITORY}'
        destination_folder: 'toFolder'
...

Not updated for a long time so i created a fork

I have made a fork with some additions that i think was lacking as this repo haven't been updated for a long time.
actions/checkout@v2 is deprecated so i use actions/checkout@v3

Added delete_existing: true [optional], that deletes all the existing files in the destination folder, before copying over the new files, that way the
destination will always be identical to the source.
That is a prerequisite for me using this action.
Thanks @jameslounds for the inspiration on this addition

Have also added:
Multiple source files/folders separated by comma "file1.txt,file2.txt" with code that iterates the input files/folders.

Push LFS file to destination

Hi, I didn't notice any syntax or option to utilize git lfs to push larger files. Would that be possible or could it be implemented? I looked around for various ways to do this (including trying to make my own "push to another repo" yaml), but it does not seem to exist.
I don't really use github issues too often, so I apologize if my use is inappropriate. I also cannot figure out how to mark this as "enhancement". I assume that such markings are done by those with the necessary permissions.

Error when building dmnemec/copy_file_to_another_repo_action@main

Running into the following error when trying to use workflow. Was working last week and I changed nothing on my end but it seems to have problems updating. If anyone has any solution to this problem please let me know.

Dockerfile:3

 2 |     
 3 | >>> RUN apk update && \
 4 | >>>     apk upgrade && \
 5 | >>>     apk add git rsync
 6 |     

ERROR: failed to solve: process "/bin/sh -c apk update && apk upgrade && apk add git rsync" did not complete successfully: exit code: 1

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.