Code Monkey home page Code Monkey logo

github-action-push-to-another-repository's Introduction

github-action-push-to-another-repository's People

Contributors

cpina avatar damiencornu avatar eibanez avatar eliminater74 avatar honqii avatar jamesmco avatar nedbat avatar oshdev avatar rottencandy avatar smellman avatar sta-szek avatar tomasvotruba avatar xenonmolecule 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

github-action-push-to-another-repository's Issues

ls: <file path>: No such file or directory

Hi, I tried to use this action to push the output directory of the Jekyll builder to another repository.
But the actions failed when this action tried to list the content of the output directory.

Here is the setup:

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      SITE_DIRECTORY: ${{ github.workspace }}/_site
    steps:
      - uses: actions/checkout@v2
      - name: Build the jekyll site
        run: |
          docker run \
          -v ${{ github.workspace }}:/srv/jekyll \
          -v ${{ env.SITE_DIRECTORY }}:/srv/jekyll/_site \
          jekyll/builder:latest \
          /bin/bash -c "chmod -R 777 /srv/jekyll && jekyll build --future"
      - name: List site directory
        run: ls ${{ env.SITE_DIRECTORY }}
      - name: Deploy to the github page repo
        uses: cpina/github-action-push-to-another-repository@main
        env:
          API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
        with:
          source-directory: ${{ env.SITE_DIRECTORY }}
          destination-github-username: LanKuDot
          destination-repository-name: lankudot.github.io
          user-email: <email>
          target-branch: main

I inserted a step to list the content of the directory, and it did.

> Run ls /home/runner/work/blog-source/blog-source/_site
assets
blog
categories
feed.xml
index.html
posts
robots.txt
sitemap.xml
tags

And the message of the action is:

Cloning into '/tmp/tmp.LfoiJn'...
ls: /home/runner/work/blog-source/blog-source/_site: No such file or directory
[+] Action start
[+] Cloning destination git repository lankudot.github.io
total 16
drwx------    3 root     root          4096 Nov 15 03:08 .
drwxrwxrwt    1 root     root          4096 Nov 15 03:08 ..
drwxr-xr-x    8 root     root          4096 Nov 15 03:08 .git
-rw-r--r--    1 root     root            52 Nov 15 03:08 README.md
[+] List contents of /home/runner/work/blog-source/blog-source/_site

Did I missed something? Thanks!

Parameters expansion stop to work since 20/01

I use your action for more than two months to push my static assets and until now everything is working as expected.
https://github.com/letssteam/pxt-lets-steam/actions/runs/1729730996/workflow#L35

Since yesterday morning, I had an issue with parameters expansion.

When my action generates the files, the target_folder become just 1 :
https://github.com/letssteam/pxt-lets-steam/runs/4899231832?check_suite_focus=true#step:8:238

The commit message becomes just 0 :
https://github.com/letssteam/pxt-lets-steam/runs/4899231832?check_suite_focus=true#step:8:351

Receive error when pushing to enterprise repo

Tested the action against one of my own repos (dmnemec) and it worked fine. Switched the destination repo to the actual target (an enterprise repo) and it received the following error

error: src refspec master does not match any
error: failed to push some refs to 'https://***@github.com/enterprise/repo.git'

I haven't dug through the code, but could this be related to the token being generated from my account but the account name and email in the action no longer being mine, but the enterprise account name instead? If so, would this require a PR to split those vars up (optionally)?

cp: can't stat 'public/.': No such file or directory

Hello!

I'm getting an error when attempting to run the action.

I'm trying to push the contents of the folder public in my repository manuelemacchia/website into my other repository manuelemacchia/manuelemacchia.github.io.

manuelemacchia/website contains the source code of a Hugo website. The folder public contains the ready-to-publish site, which I want to publish using GitHub pages. To do so, I need to copy the contents of public into manuelemacchia/manuelemacchia.github.io.

However, when I push to manuelemacchia/website to trigger the action, I get the following error: cp: can't stat 'public/.': No such file or directory.

Here's the full logs:

2021-03-28T14:25:08.0528043Z ##[section]Starting: Request a runner to run this job
2021-03-28T14:25:08.2456611Z Can't find any online and idle self-hosted runner in current repository that matches the required labels: 'ubuntu-latest'
2021-03-28T14:25:08.2456728Z Can't find any online and idle self-hosted runner in current repository's account/organization that matches the required labels: 'ubuntu-latest'
2021-03-28T14:25:08.2456949Z Found online and idle hosted runner in current repository's account/organization that matches the required labels: 'ubuntu-latest'
2021-03-28T14:25:08.3828128Z ##[section]Finishing: Request a runner to run this job
2021-03-28T14:25:15.7252548Z Current runner version: '2.277.1'
2021-03-28T14:25:15.7274544Z ##[group]Operating System
2021-03-28T14:25:15.7275362Z Ubuntu
2021-03-28T14:25:15.7275781Z 20.04.2
2021-03-28T14:25:15.7276174Z LTS
2021-03-28T14:25:15.7276532Z ##[endgroup]
2021-03-28T14:25:15.7277008Z ##[group]Virtual Environment
2021-03-28T14:25:15.7277516Z Environment: ubuntu-20.04
2021-03-28T14:25:15.7278016Z Version: 20210318.0
2021-03-28T14:25:15.7278802Z Included Software: https://github.com/actions/virtual-environments/blob/ubuntu20/20210318.0/images/linux/Ubuntu2004-README.md
2021-03-28T14:25:15.7279903Z Image Release: https://github.com/actions/virtual-environments/releases/tag/ubuntu20%2F20210318.0
2021-03-28T14:25:15.7280788Z ##[endgroup]
2021-03-28T14:25:15.7283937Z ##[group]GITHUB_TOKEN Permissions
2021-03-28T14:25:15.7286022Z Actions: write
2021-03-28T14:25:15.7286420Z Checks: write
2021-03-28T14:25:15.7286844Z Contents: write
2021-03-28T14:25:15.7287253Z Deployments: write
2021-03-28T14:25:15.7287779Z Issues: write
2021-03-28T14:25:15.7288513Z Metadata: read
2021-03-28T14:25:15.7289048Z OrganizationPackages: write
2021-03-28T14:25:15.7289544Z Packages: write
2021-03-28T14:25:15.7290040Z PullRequests: write
2021-03-28T14:25:15.7290546Z RepositoryProjects: write
2021-03-28T14:25:15.7291532Z SecurityEvents: write
2021-03-28T14:25:15.7291962Z Statuses: write
2021-03-28T14:25:15.7292528Z ##[endgroup]
2021-03-28T14:25:15.7295263Z Prepare workflow directory
2021-03-28T14:25:15.7840222Z Prepare all required actions
2021-03-28T14:25:15.7849595Z Getting action download info
2021-03-28T14:25:16.1682404Z Download action repository 'cpina/github-action-push-to-another-repository@master'
2021-03-28T14:25:18.3400165Z ##[group]Build container for action use: '/home/runner/work/_actions/cpina/github-action-push-to-another-repository/master/Dockerfile'.
2021-03-28T14:25:18.3470260Z ##[command]/usr/bin/docker build -t 5588e4:16a2b368ac7a4e9797059f7150f5fd2e -f "/home/runner/work/_actions/cpina/github-action-push-to-another-repository/master/Dockerfile" "/home/runner/work/_actions/cpina/github-action-push-to-another-repository/master"
2021-03-28T14:25:19.2250546Z Sending build context to Docker daemon  12.29kB
2021-03-28T14:25:19.2261830Z 
2021-03-28T14:25:19.2262483Z Step 1/4 : FROM alpine:3.12
2021-03-28T14:25:20.5350221Z 3.12: Pulling from library/alpine
2021-03-28T14:25:20.9012023Z 22599d3e9e25: Pulling fs layer
2021-03-28T14:25:21.2997336Z 22599d3e9e25: Verifying Checksum
2021-03-28T14:25:21.3012088Z 22599d3e9e25: Download complete
2021-03-28T14:25:21.4286799Z 22599d3e9e25: Pull complete
2021-03-28T14:25:21.4348944Z Digest: sha256:d1eaae2a6814b4b10a722fa75e8a6b53db42d1bf531395a107fea0458bfbf1d8
2021-03-28T14:25:21.4377334Z Status: Downloaded newer image for alpine:3.12
2021-03-28T14:25:21.4387523Z  ---> 42cb162f0360
2021-03-28T14:25:21.4388537Z Step 2/4 : RUN apk add --no-cache git
2021-03-28T14:25:21.6153012Z  ---> Running in d7cc411b8351
2021-03-28T14:25:22.0120482Z fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
2021-03-28T14:25:22.0684407Z fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
2021-03-28T14:25:22.1695602Z (1/6) Installing ca-certificates (20191127-r4)
2021-03-28T14:25:22.1903830Z (2/6) Installing nghttp2-libs (1.41.0-r0)
2021-03-28T14:25:22.1981923Z (3/6) Installing libcurl (7.69.1-r3)
2021-03-28T14:25:22.2105114Z (4/6) Installing expat (2.2.9-r1)
2021-03-28T14:25:22.2173323Z (5/6) Installing pcre2 (10.35-r0)
2021-03-28T14:25:22.2305499Z (6/6) Installing git (2.26.3-r0)
2021-03-28T14:25:22.3843844Z Executing busybox-1.31.1-r19.trigger
2021-03-28T14:25:22.3876177Z Executing ca-certificates-20191127-r4.trigger
2021-03-28T14:25:22.4127669Z OK: 22 MiB in 20 packages
2021-03-28T14:25:23.2116495Z Removing intermediate container d7cc411b8351
2021-03-28T14:25:23.2117318Z  ---> 8c54f30c2d23
2021-03-28T14:25:23.2117807Z Step 3/4 : COPY entrypoint.sh /entrypoint.sh
2021-03-28T14:25:24.0082829Z  ---> e17e4025f585
2021-03-28T14:25:24.0083401Z Step 4/4 : ENTRYPOINT ["/entrypoint.sh"]
2021-03-28T14:25:24.0252945Z  ---> Running in b3ad1d627156
2021-03-28T14:25:25.0092155Z Removing intermediate container b3ad1d627156
2021-03-28T14:25:25.0164054Z  ---> 3a0e2ed762da
2021-03-28T14:25:25.0164610Z Successfully built 3a0e2ed762da
2021-03-28T14:25:25.0165229Z Successfully tagged 5588e4:16a2b368ac7a4e9797059f7150f5fd2e
2021-03-28T14:25:25.0177616Z ##[endgroup]
2021-03-28T14:25:25.0459702Z ##[group]Run cpina/github-action-push-to-another-repository@master
2021-03-28T14:25:25.0460599Z with:
2021-03-28T14:25:25.0460970Z   source-directory: public
2021-03-28T14:25:25.0461589Z   destination-github-username: manuelemacchia
2021-03-28T14:25:25.0462373Z   destination-repository-name: manuelemacchia.github.io
2021-03-28T14:25:25.0463047Z   target-branch: main
2021-03-28T14:25:25.0463481Z   user-email: [email protected]
2021-03-28T14:25:25.0464057Z   commit-message: Update from ORIGIN_COMMIT
2021-03-28T14:25:25.0464444Z env:
2021-03-28T14:25:25.0465532Z   API_TOKEN_GITHUB: ***
2021-03-28T14:25:25.0465947Z ##[endgroup]
2021-03-28T14:25:25.0519807Z ##[command]/usr/bin/docker run --name e416a2b368ac7a4e9797059f7150f5fd2e_a1e812 --label 5588e4 --workdir /github/workspace --rm -e API_TOKEN_GITHUB -e INPUT_SOURCE-DIRECTORY -e INPUT_DESTINATION-GITHUB-USERNAME -e INPUT_DESTINATION-REPOSITORY-NAME -e INPUT_TARGET-BRANCH -e INPUT_USER-EMAIL -e INPUT_DESTINATION-REPOSITORY-USERNAME -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/website/website":"/github/workspace" 5588e4:16a2b368ac7a4e9797059f7150f5fd2e  "public" "manuelemacchia" "manuelemacchia.github.io" "[email protected]" "" "main" "Update from ORIGIN_COMMIT"
2021-03-28T14:25:25.3645154Z Starts
2021-03-28T14:25:25.3658672Z Cloning destination git repository
2021-03-28T14:25:25.3702459Z Cloning into '/tmp/tmp.icaKLD'...
2021-03-28T14:25:25.8142179Z total 88
2021-03-28T14:25:25.8143076Z drwx------    9 root     root          4096 Mar 28 14:25 .
2021-03-28T14:25:25.8143580Z drwxrwxrwt    1 root     root          4096 Mar 28 14:25 ..
2021-03-28T14:25:25.8144164Z drwxr-xr-x    8 root     root          4096 Mar 28 14:25 .git
2021-03-28T14:25:25.8144794Z -rw-r--r--    1 root     root           871 Mar 28 14:25 404.html
2021-03-28T14:25:25.8145412Z -rw-r--r--    1 root     root            18 Mar 28 14:25 CNAME
2021-03-28T14:25:25.8146040Z -rw-r--r--    1 root     root            26 Mar 28 14:25 README.md
2021-03-28T14:25:25.8146703Z drwxr-xr-x    2 root     root          4096 Mar 28 14:25 categories
2021-03-28T14:25:25.8147383Z drwxr-xr-x    2 root     root          4096 Mar 28 14:25 fonts
2021-03-28T14:25:25.8147985Z drwxr-xr-x    2 root     root          4096 Mar 28 14:25 icons
2021-03-28T14:25:25.8148686Z -rw-r--r--    1 root     root          1368 Mar 28 14:25 index.html
2021-03-28T14:25:25.8149294Z -rw-r--r--    1 root     root           532 Mar 28 14:25 index.xml
2021-03-28T14:25:25.8149988Z -rw-r--r--    1 root     root         27662 Mar 28 14:25 profile.jpg
2021-03-28T14:25:25.8150605Z drwxr-xr-x    2 root     root          4096 Mar 28 14:25 resume
2021-03-28T14:25:25.8151240Z drwxr-xr-x    2 root     root          4096 Mar 28 14:25 scss
2021-03-28T14:25:25.8151831Z -rw-r--r--    1 root     root           411 Mar 28 14:25 sitemap.xml
2021-03-28T14:25:25.8152682Z drwxr-xr-x    2 root     root          4096 Mar 28 14:25 tags
2021-03-28T14:25:25.8160579Z Copying contents to git repo
2021-03-28T14:25:25.8165665Z cp: can't stat 'public/.': No such file or directory
2021-03-28T14:25:25.9555298Z Cleaning up orphan processes

This is the .yml file:

name: publish-site

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - name: Push directory to another repository
        uses: cpina/github-action-push-to-another-repository@master
        env:
          API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
        with:
          source-directory: 'public'
          destination-github-username: 'manuelemacchia'
          destination-repository-name: 'manuelemacchia.github.io'
          target-branch: main
          user-email: [email protected]

Is there something I'm doing wrong?

Arg target-directory is not working

Hello I try to use this action but I think there a issue when I try to use the arg target-directory, can you help to undestand why I having this issue.

My pipeline is:

`name: Push File

on: push

jobs:
copy-file:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- run: |
chmod +x ./build.sh
./build.sh
- name: Push directory to another repository
uses: cpina/[email protected]
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source-directory: 'output'
destination-github-username: 'rafaeltovargarrido'
destination-repository-name: 'restaurant'
user-email: [email protected]
commit-message: See ORIGIN_COMMIT from $GITHUB_REF
target-branch: master
target-directory: tr-rafa/hola`

I want to create this folder tr-rafa/hola in the other repo with context of the folder output.

Error I have when I run the action.

copy-file Unexpected input(s) 'target-directory', valid inputs are ['entryPoint', 'args', 'source-directory', 'destination-github-username', 'destination-repository-name', 'user-email', 'destination-repository-username', 'target-branch', 'commit-message']

Is it possible to add a inputs parameter to allow people to customize the content of git commit?

hello Cpina! Just like the question says, sometimes i want to add some content to the git commit, maybe like this:

- name: Pushes to another repository
        uses: cpina/github-action-push-to-another-repository@master
        env:
          API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
        with:
          source-directory: 'output'
          destination-github-username: 'cpina'
          destination-repository-name: 'push-to-another-repository-output'
          user-email: [email protected]
          commit-content: 'an example'

Is it possible to add this?

Thanks !

Support for "main" branch [Feature Request]

First of all, I think this is a great extension! We use it in the build pipeline at @QuantEcon projects.

My question is, since GitHub has switched over to main as the new default branch, is it possible to add some sort of switching logic? (i.e., check if main and master exist... use if only one exists, choose a default if both exist?)

For example, this is the alias I set up to purge non-master branches from a repo. I think something like this could work:

alias gbr='git branch | grep -v master | xargs git branch -D'

Write tests

(Maintainer here)

Before adding more features and merging PRs (unless they fix an error) I want to write tests for the github action (should have been done long time ago).

Testing the action is getting harder and harder as we add features and I really want to avoid regressions.

I might have some time towards end of February 2022 but if anyone wants to have a look at writing tests it might speed up PR and issues.

I haven't planed yet how to implement the tests. If someone wants to help it might be a good idea to discuss options here.

Thanks for using it and for your patience!

Doesnt seem to follow Symbolic links

No matter what I do, this doesnt seem to follow Symbolic links at all..

I have tried over and over to find out why it wouldnt change to Directory always said no such directory..

dir is a Symbolic link, but this doesnt see it.....

How to push tags as well?

Hi,

thank you for amazing package. It's doing so much work for me ๐Ÿ‘

I have a use case, when I push master branch.
I also need to push current tag.

In Travis, it was possible to do something like this:

 - if [ "${TRAVIS_TAG}" != "" ]; then git tag "${TRAVIS_TAG}" && git push --quiet origin ${TRAVIS_TAG}; fi

Would something like this be possible here too?

Thank you

Erroring with API_TOKEN_GITHUB as empty even though it's set

After ab68811, I'm now getting

Error: API_TOKEN_GITHUB and SSH_DEPLOY_KEY are empty. Please fill one (recommended the SSH_DEPLOY_KEY

on all my runs, despite API_TOKEN_GITHUB being set in the workflow:

 uses: cpina/github-action-push-to-another-repository@main
 env:
   API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
 with:

(and yes, the secret is set.)

This worked prior to the update, so it's definitely not a config issue on my end.

elif [ -n "${API_TOKEN_GITHUB:=}" ]

It's this check which is failing for whatever reason.
(Also, even if that check worked, the command you're setting there to be run doesn't actually have the token in. You probably want to split the "redacted for display" and "actually used" strings into two different variables.)

files not deleted

Hi there and thanks for creating this action.
I realized that (maybe for a while, maybe since a recent change) deleted files aren't included in the commit to the dest. repository. It looks like this has something to do with the new TARGET_DIRECTORY, if none is set, it wont remove the content from the root. And cp will just add new files.
I didn't really want to touch the TARGET_DIRECTORY logic, but solved it with rsync.
Maybe this is just us and our workflow, but if you get more issues like this, here is a fork
https://github.com/spiribo/github-action-push-to-another-repository

Cheers,
Levin

Support GHES

Hi, your action seems like it is doing exactly what I would need, but I can't use it because it won't work with GHES as github.com is the hardcoded server url. It would be great to consider this, similar to the checkout action.

How to push the whole repository files to another repository ?

How can I push the whole repository files to another repository ?
If I put an empty string it throws an error :
`

  • name: Pushes to another repository
    uses: cpina/github-action-push-to-another-repository@main
    env:
    API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
    with:
    source-directory: ""
    destination-github-username: "username"
    destination-repository-name: "page"
    user-email: [email protected]
    commit-message: commit message
    target-branch: master
    `

Add an argument for folders / files to ignore

A functionality to ignore some folders and files might be really useful.
I recently tried using this action to copy the whole repo to another repo in order to host it.

.git folder was also copied in the copy step resulting in the action trying to push back to source repo and fails.

Incorrect usage of `user-name` argument

The user-name argument is supposed to be the equivalent of setting git config user.name when using this action. Typically, this will be the real name of the person performing a commit, with name, surname and all.

For example, in my case it usually is "Gabriele Ara".

However, it is later used as a github username when cloning the destination repository, which is incorrect.
Apparently, the destination-gtihub-username should be used instead.

Example (from one of my repositories):

- name: Deploy on Personal Website
  uses: cpina/github-action-push-to-another-repository@main
  env:
    API_TOKEN_GITHUB: '${{ secrets.API_TOKEN_GITHUB }}'
  with:
    #  other non relevant options ...
    destination-github-username: 'gabrieleara'
    destination-github-repository: 'gabrieleara.github.io'
    user-name: 'Gabriele Ara'
    github-server: 'github.com'
    destination-repository-username: 'gabrieleara'

The above snippet failed with the following error in my case:

fatal: unable to access 'https://github.com/gabrieleara/gabrieleara.github.io.git/': URL using bad/illegal format or missing URL
Error: Could not clone the destination repository. Command:
Error: git clone --single-branch --branch main https://Gabriele Ara:[email protected]/gabrieleara/gabrieleara.github.io.git /tmp/tmp.gaKCCN
Error: (Note that the USER_NAME and API_TOKEN is redacted by GitHub)
Error: Please verify that the target repository exist AND that it contains the destination branch name, and is accesible by the API_TOKEN_GITHUB

where it is clearly visible that the value of the user-name attribute is used instead of the destination-github-username one.

Support Git LFS

I tried to upload the files as my personal report, but I saw this error.

remote: error: File ๋นจ๋ ค๋“ค์–ด๊ฐˆ ๊ฑฐ ๊ฐ™์• (๋งˆ์ธํฌ๋ž˜ํ”„ํŠธ) [GQYfmvrdySc].mkv is 165.31 MB; this exceeds GitHub's file size limit of 100.00 MB        
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.        
To https://github.com/rophin/DownloadResult.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to '***github.com/rophin/DownloadResult.git'

So I looked up the document to see if Git LFS was also possible to commit, but I couldn't find it. That's why I want you to support the Git LFS commit.

Improve documentation: screenshots and better steps

Recently I added support for ssh deploy keys.

The documentation could be improved with screenshots, better writing of the steps.

I plan to do it in the future but if anyone would like to step in please get in touch in this issue and we can discuss an approach / structure.

Variable in commit-message ?

Hey would it be possible to make

      - name: Push to the repository which will create the staticfiles pod into the cluster
        uses: cpina/github-action-push-to-another-repository@master
        env:
          API_TOKEN_GITHUB: ${{ secrets.REPO_ACCESS_TOKEN }}
        with:
          source-directory: 'staticfiles_pod'
          destination-github-username: 'xxxx'
          destination-repository-name: 'staticfiles'
          user-email: [email protected]
          commit-message: "new front static files"
          commit-message: "#patch new front static files generated ${GITHUB_REF##*/}"

Does not copy files whose name begins with a dot - such as .eslintrc.json, .prettierignore and .prettierrc.json

Thanks for the action, it's very useful!

The problem is that files such as .eslintrc.json, .prettierignore and .prettierrc.json are ignored and not copied to the repository.

They are also not mentioned in the terminal:

Cloning destination git repository
total 52
drwx------    6 root     root          4096 Mar 23 20:43 .
drwxrwxrwt    1 root     root          4096 Mar 23 20:43 ..
drwxr-xr-x    8 root     root          4096 Mar 23 20:43 .git
-rw-r--r--    1 root     root           945 Mar 23 20:43 .gitignore
-rw-r--r--    1 root     root             0 Mar 23 20:43 .gitkeep
-rw-r--r--    1 root     root          1077 Mar 23 20:43 LICENSE
-rw-r--r--    1 root     root          1588 Mar 23 20:43 README.md
drwxr-xr-x    5 root     root          4096 Mar 23 20:43 content
-rwxr-xr-x    1 root     root          2882 Mar 23 20:43 gatsby-config.js
-rw-r--r--    1 root     root           466 Mar 23 20:43 gatsby-node.js
-rw-r--r--    1 root     root            56 Mar 23 20:43 netlify.toml
-rwxr-xr-x    1 root     root          1011 Mar 23 20:43 package.json
drwxr-xr-x    7 root     root          4096 Mar 23 20:43 src
drwxr-xr-x    3 root     root          4096 Mar 23 20:43 static

only files related to the git are not ignored (which also have a dot).

I use this action in open source, so if it somehow helps, here's the repository where it is used: https://github.com/Chronoblog/gatsby-theme-chronoblog

Possible Bug

My repo is public but gives to me this error:

/usr/bin/docker run --name d5371714bb4b94[16](https://github.com/Squirrel-Network/GoBotApiGenerator/runs/6626431174?check_suite_focus=true#step:9:17)08106041dc82200fd_8ab128 --label 08450d --workdir /github/workspace --rm -e VERSION -e API_TOKEN_GITHUB -e INPUT_COMMIT-MESSAGE -e INPUT_SOURCE-DIRECTORY -e INPUT_DESTINATION-GITHUB-USERNAME -e INPUT_USER-NAME -e INPUT_DESTINATION-REPOSITORY-NAME -e INPUT_USER-EMAIL -e INPUT_TARGET-BRANCH -e INPUT_SOURCE-BEFORE-DIRECTORY -e INPUT_GITHUB-SERVER -e INPUT_DESTINATION-REPOSITORY-USERNAME -e INPUT_TARGET-DIRECTORY -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_RUN_ATTEMPT -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_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -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 GITHUB_STEP_SUMMARY -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -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/GoBotApiGenerator/GoBotApiGenerator":"/github/workspace" 08450d:537[17](https://github.com/Squirrel-Network/GoBotApiGenerator/runs/6626431174?check_suite_focus=true#step:9:18)14bb4b941608106041dc82[20](https://github.com/Squirrel-Network/GoBotApiGenerator/runs/6626431174?check_suite_focus=true#step:9:21)0fd  "" "./gobotapi" "Squirrel-Network" "gobotapi" "github.com" "<>" "Laky-64" "" "master" "Update to v 1.0.1" ""
[+] Action start
[+] Git version
git version 2.36.1
[+] Cloning destination git repository gobotapi
Cloning into '/tmp/tmp.bMBmfD'...
fatal: unable to access 'https://github.com/Squirrel-Network/gobotapi.git/': URL using bad/illegal format or missing URL
Error: Could not clone the destination repository. Command:
Error: git clone --single-branch --branch master ***github.com/Squirrel-Network/gobotapi.git /tmp/tmp.bMBmfD
Error: (Note that USER_NAME and API_TOKEN is redacted by GitHub)
Error: Please verify that the target repository exist AND that it contains the destination branch name, and is accesible by the API_TOKEN_GITHUB

My yaml:

- name: Update Compiled GoBotAPI
    uses: cpina/github-action-push-to-another-repository@main
      env:
          API_TOKEN_GITHUB: "${{ secrets.API_TOKEN_GITHUB }}"
        with:
          commit-message: "Update to v 1.1.2"
          source-directory: './gobotapi'
          destination-github-username: 'Squirrel-Network'
          user-name: 'Laky-64'
          destination-repository-name: 'gobotapi'
          user-email: <>
          target-branch: master

Question: How are "missing" files handled?

Hi,

For our workflow we generate a number of artifacts based on our main repository branch and are pushing those artifacts to a separate repo. How does this workflow handle files that might be removed? Will those still be available in the git history of the target repo or is the entire history overwritten?

Thanks

nothing to commit, working tree clean

Hi
No matter what I do, I'm constantly seeing this in logs:

[+] Adding git commit
[+] git status:
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
[+] git diff-index:
[+] Pushing git commit
Everything up-to-date
Branch 'master' set up to track remote branch 'master' from 

The job sees source and target directories correctly but even after merging a PR to master, it can't track new changes. Can't figure out what I'm doing wrong.

Support using deploy keys

I see that this action and several actions like it rely on using Personal Access Tokens for write permissions. I don't like to use PATs because (as far as I know) they can't be scoped to a single repo. If they allow write access to one repo, they allow write access to all of your (and all of the organizations you belong to's) repos.

I'm looking to have some kind of authentication that just allows writing from one repo to another single public repo. It seems like GitHub deploy keys would be the way to accomplish this.

This action seems to do just that:
https://github.com/leigholiver/commit-with-deploy-key

But it's not widely used/tested.

Your action seems to be the defacto standard for this type of thing, so an option for this would be nice.

fatal: unsafe repository ('XXXXXX' is owned by someone else)

Hi,

I'm encountering an error when running this action to push to another repo:

fatal: unsafe repository ('/tmp/tmp.PklpEM' is owned by someone else)

To add an exception for this directory, call:

	git config --global --add safe.directory /tmp/tmp.PklpEM

Looks like this is related to this.

I have tried already setting the ownership of the containing folder in a previous step in my job but no luck yet.

Is there any workaround?

Thanks in advance

Support MacOS

I tried to run your action on macOS machine but got error:
Error: Container action is only supported on Linux

Can you add support for macOS

Push fails with unsafe repository fatal error

Our actions started failing recently with the following error:

fatal: unsafe repository ('/tmp/tmp.ekmOIH' is owned by someone else)
To add an exception for this directory, call:

	git config --global --add safe.directory /tmp/tmp.ekmOIH

This is a related issue that I found with the checkout action. It appears some have worked around this issue by adding a step before the action:

- name: work around permission issue
   run: git config --global --add safe.directory /tmp/tmp.ekmOIH

However, with this action, it looks like the tmp that gets created has a different id each time the action is run. So, I'm not sure how we could work around the issue. Any help or guidance on this would be great. Thanks!

Problems using across organizations repositories

It serves very well what I need.
I ran several tests on my personal account, with success.

However, when trying to use Git Action on an organization account, I get an error.

[+] Pushing git commit
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/open-geodata/open-geodata.github.io.git/'

Already tried:

  1. Add the personal token I created in https://github.com/settings/tokens as the organization secret. Did not work.
  2. Add in the personal token, in addition to the "repo", the "workflow". Also to no avail.

Interestingly, if I try to push my organization repository, from a command line, using https, login and api, the push works!!
... that is, there is no problem with the credentials!... but the Git Action still doesn't work!

git add .

git commit -m "Test"

git push https://michelmetran:[email protected]/open-geodata/open-geodata.github.io.git

Is there any way around the problem?

cp: can't stat 'examples/chronoblog-netlify-cms/*': No such file or directory

Hey! Thanks for this project.

Perhaps I don't understand something, but I get an error:

cp: can't stat 'examples/chronoblog-netlify-cms/.': No such file or directory

when launching an action.

Here is the complete code of the yml file:

name: Publication of Starters

on: push

jobs:
  copy-file:
    runs-on: ubuntu-latest
    steps:
      - name: Push directory to another repository
        uses: cpina/[email protected]
        env:
          API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
        with:
          source-directory: "examples/chronoblog-netlify-cms"
          destination-github-username: "Chronoblog"
          destination-repository-name: "gatsby-starter-chronoblog-netlify-cms"
          user-email: [email protected]
      - name: Test get variable exported by push-to-another-repository
        run: echo $DESTINATION_CLONED_DIRECTORY

Yes, this is an open source project, here is the entire mono repository from which I'm trying to copy some of the files: https://github.com/Chronoblog/gatsby-theme-chronoblog/tree/test-workflows

And this is the repository where I'm trying to copy the "examples/chronoblog-netlify-cms" folder: https://github.com/Chronoblog/gatsby-starter-chronoblog-netlify-cms

Maybe the problem is that I'm using the name of the organization? (Chronoblog)

Wrong user-email argument

Hi there!

##[warning]Unexpected input 'git-user-email', valid inputs are ['entryPoint', 'args', 'source-directory', 'destination-github-username', 'destination-repository-name', 'user-email']

Your example says I should use git-user-email, but correct is user-email

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.