Git Product home page Git Product logo

betahuhn / repo-file-sync-action Goto Github PK

View Code? Open in Web Editor NEW
261.0 8.0 78.0 2.16 MB

๐Ÿ”„ GitHub Action to keep files like Action workflows or entire directories in sync between multiple repositories.

Home Page: https://github.com/marketplace/actions/repo-file-sync-action

License: MIT License

JavaScript 100.00%
github-actions file-sync workflow-sync github-workflow github-action-workflow-sync sync sync-action workflow-files

repo-file-sync-action's People

Contributors

adaam avatar aidanfogarty avatar alvarezfr avatar arjunreddyk avatar balazsorban44 avatar barrydobson avatar betahuhn avatar betahuhnbot avatar bytestream avatar dependabot[bot] avatar dhruvkb avatar erezrokah avatar exaspark avatar grahammcculloch avatar jpoehnelt avatar leocete avatar maikenp avatar nef10 avatar phnx47 avatar samagius avatar sammcj avatar sorekz avatar svg153 avatar thomasleclaire avatar xanjohns 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  avatar

repo-file-sync-action's Issues

Fails to sync

Having a problem where its not wanting to sync.

๐Ÿž Describe the bug

Action will not process

๐Ÿ“š To Reproduce
run my file-sync.yml action

๐Ÿ’ก Expected behavior

completes assigned tasks

๐Ÿ–ผ๏ธ Screenshots

[](http:// .github/workflows/file-sync.yml

Exclude should not remove excluded files if deleteOrphaned is true

๐Ÿž Describe the bug

Files which are excluded are still being deleted if deleteOrphaned is true.

This seems to be an edge case when using deleteOrphaned and excluded. However I still think it is a bug, at least not the behaviour I am expecting.

๐Ÿ“š To Reproduce

  1. Create a sync for a folder
  2. Set deleteOrphaned to true
  3. Exclude a specific file in this folder, which is not present
  4. Sync to a repo where this file is present

๐Ÿ’ก Expected behavior

The file should not be deleted.

๐Ÿ–ผ๏ธ Screenshots

Screen Shot 2021-09-04 at 9 01 30 PM

Screen Shot 2021-09-04 at 9 01 10 PM

โš™๏ธ Environment

@v1 (using 1.12.0)

Newest version does not run after ESM change

๐Ÿž Describe the bug

2023-01-07T17:44:55.0909616Z ##[endgroup]
2023-01-07T17:44:55.1588432Z undefined:1
2023-01-07T17:44:55.1589393Z require
2023-01-07T17:44:55.1589809Z ^
2023-01-07T17:44:55.1590021Z 
2023-01-07T17:44:55.1590612Z ReferenceError: require is not defined in ES module scope, you can use import instead
2023-01-07T17:44:55.1592294Z This file is being treated as an ES module because it has a '.js' file extension and '/home/runner/work/_actions/BetaHuhn/repo-file-sync-action/v1/dist/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
2023-01-07T17:44:55.1593995Z     at eval (eval at 539 (file:///home/runner/work/_actions/BetaHuhn/repo-file-sync-action/v1/dist/index.js:1:41342), <anonymous>:1:1)
2023-01-07T17:44:55.1594984Z     at Object.539 (file:///home/runner/work/_actions/BetaHuhn/repo-file-sync-action/v1/dist/index.js:1:41342)
2023-01-07T17:44:55.1595948Z     at __nccwpck_require__ (file:///home/runner/work/_actions/BetaHuhn/repo-file-sync-action/v1/dist/index.js:1:42491)
2023-01-07T17:44:55.1596987Z     at file:///home/runner/work/_actions/BetaHuhn/repo-file-sync-action/v1/dist/index.js:1:42877
2023-01-07T17:44:55.1597862Z     at file:///home/runner/work/_actions/BetaHuhn/repo-file-sync-action/v1/dist/index.js:1:47000
2023-01-07T17:44:55.1598624Z     at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
2023-01-07T17:44:55.1599193Z     at async Promise.all (index 0)
2023-01-07T17:44:55.1599766Z     at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
2023-01-07T17:44:55.1600397Z     at async loadESM (node:internal/process/esm_loader:88:5)
2023-01-07T17:44:55.1601027Z     at async handleMainPromise (node:internal/modules/run_main:65:12)

๐Ÿ“š To reproduce

Just try to run it

๐Ÿ’ก Expected behavior

It syncs

๐Ÿ–ผ๏ธ Screenshots

No response

โš™๏ธ Environment

Version 69868d68f6969b7a599ca783823eb29e3b3679e8

๐Ÿ“‹ Additional context

See https://github.com/Nef10/common-swift-package/actions/runs/3863217212/jobs/6585266148

Replace & deleteOrphaned always have the value of default

๐Ÿž Describe the bug

When setting a file to replace: false the setting is always true

๐Ÿ“š To Reproduce

Add a sync config that has the replace field set to false for a file

๐Ÿ’ก Expected behavior

Expect file to not be replaced

โš™๏ธ Environment

  • Action version: latest

Missing Documentation for PR_BODY property

๐Ÿž Describe the bug

The README.md does not have documentation for the PR_BODY property how it works and what the default is.

Would also be nice to have an example for folks to follow.

`deleteOrphaned` Option Doesn't Delete Hidden Files

๐Ÿž Describe the bug

With deleteOrphaned enabled, files beginning with . are not deleted from the synced directory.

๐Ÿ“š To Reproduce

Create the following folder structure:

Sync Repository

docker/
    Dockerfile

Target Repository

docker/
    .env

Sync the entire docker/ folder with deleteOrphaned set to true.

๐Ÿ’ก Expected behavior

deleteOrphaned should delete every file within the target repo which isn't also in the sync repo. In the example above, .env is missed.

๐Ÿ–ผ๏ธ Screenshots

If applicable, add screenshots to help explain your problem.

โš™๏ธ Environment

  • Action version: latest

๐Ÿ“‹ Additional context

N/A

Reporting a vulnerability

Hello!

I hope you are doing well!

We are a security research team. Our tool automatically detected a vulnerability in this repository. We want to disclose it responsibly. GitHub has a feature called Private vulnerability reporting, which enables security research to privately disclose a vulnerability. Unfortunately, it is not enabled for this repository.

Can you enable it, so that we can report it?

Thanks in advance!

PS: you can read about how to enable private vulnerability reporting here: https://docs.github.com/en/code-security/security-advisories/repository-security-advisories/configuring-private-vulnerability-reporting-for-a-repository

Exclude overlap causing missed files in sync

๐Ÿž Describe the bug

Using exclude in the sync config appears to break further overlapping sync group configs.

๐Ÿ“š To reproduce

Here's an abbreviated example:

groups:
  - files:
      - folder/
        exclude: b.txt
    repos: |
      org/repo@master

  - files:
      - folder/b.txt
    repos: |
      org/repo@master

In this example, b.txt is never synced. In our use-case, we were looking to sync a mostly standard template that was structured appropriately, but include unique Dockerfiles from a different folder.

๐Ÿ’ก Expected behavior

I'd expect both files a.txt and b.txt to be synced to the repo.

๐Ÿ–ผ๏ธ Screenshots

No response

โš™๏ธ Environment

v1.21.0

๐Ÿ“‹ Additional context

No response

Sync subfolder to destination

๐Ÿž Describe the bug

I would like to sync a subfolder from the direct_sync_to_root_of_repo to the destination .github folder:

.
โ””โ”€โ”€ direct_sync_to_root_of_repo
    โ””โ”€โ”€ .github
        โ””โ”€โ”€ metaconfig.yaml

This however creates a PR under direct_sync_to_root_of_repo/.github/metaconfig.yaml.

๐Ÿ“š To reproduce

group:
  - files:
    - source: direct_sync_to_root_of_repo/
      dest: ./
      template: false

๐Ÿ’ก Expected behavior

Exact folder hierarchy syned to destination.

๐Ÿ–ผ๏ธ Screenshots

No response

โš™๏ธ Environment

v1.21.0

๐Ÿ“‹ Additional context

No response

Exclude no longer works on version v1.18.00

๐Ÿž Describe the bug

When syncing folders between two repos suddenly the exclude functionality no longer works.

My code:

  • source : ais/groeps
    dest : docs/ais
    • source : ais
      dest : ais
      exclude: |
      groeps
      docs

When syncing the source ais folder to destination folder ais the groeps and docs subfolders are also synced and should be ignored.

This worked perfectly prio to 18/11/2022 around 11:41AM GMT+1 ?

๐Ÿ“š To reproduce

Removing the code below stops syncing the mentioned subfolders :

  • source : ais
    dest : ais
    exclude: |
    groeps
    docs

When I re-aply the code, the groeps and docs folders are synced again (exclude is ignored).

๐Ÿ’ก Expected behavior

The groeps and docs folders should not be synced as they are defined in the exclude list.

๐Ÿ–ผ๏ธ Screenshots

No response

โš™๏ธ Environment

Current runner version: '2.299.1'

๐Ÿ“‹ Additional context

No response

Action showing error

๐Ÿž Describe the bug

The actions shows errors: core.notice is not a function and syncTypeError: core.notice is not a function, assignee and labels are not set. See here.

๐Ÿ“š To Reproduce

Run the action with a file to sync.

๐Ÿ’ก Expected behavior

No error, assignee are labels set as configured.

๐Ÿ–ผ๏ธ Screenshots

Screen Shot 2021-09-06 at 5 14 39 PM

โš™๏ธ Environment

Latest

๐Ÿ“‹ Additional context

The problem was caused because the built after merging #101 was not done correctly (it used outdated dependencies). As I noted in the PR:

When working on this I noticed that the current version does not seem to be built correctly. When I check out develop and run a build there is a diff to the checked in dist file. This change seems to be the bump of @actions/core to 1.5.0. This version is required for this change, so please make sure to update the dependencies to the version of the lock file before building.

`latest` is no longer adding labels

๐Ÿž Describe the bug

I have this setup for a number of repositories. I was using latest and I've also tried @v1

This was working last time I added changes.

๐Ÿ“š To Reproduce

Run workflow with labels specified

๐Ÿ’ก Expected behavior

The label should be added to the PR

๐Ÿ–ผ๏ธ Screenshots

Here is one of the PRs from the last couple runs with latest and @v1: PR

I tried running multiple times and the label is not added.

โš™๏ธ Environment

  • Action version: latest

Action is pulling in binary files in a repo

๐Ÿž Describe the bug
Syncing a file in a repo that has binary files will include those binary files in the PR and also modifies them.

Bug is recreated in this repo:

https://github.com/cds-snc/sre-test-repo

Here is the PR:
cds-snc/sre-test-repo#2

Please note this PR was triggered by another repo just to prove that it does occur in normal usage instead of just in the repo it was run in as I originally reported.

๐Ÿ“š To Reproduce

  • authenticate using a Token from a GitHub App installation

  • Add a binary file to a repo.

To create a basic binary file run the following command in bash

echo "00000000: ff" | xxd -r - binary.dat
  • Run the action and the binary file will be apart of the PR even if it is not part of the configuration.

๐Ÿ’ก Expected behavior

I expect only the files identified to show up in the repo.

๐Ÿ–ผ๏ธ Screenshots

Screen shot of files in PR in case it dissapears.

image

โš™๏ธ Environment
We pin Git SHA

๐Ÿ“‹ Additional context

It converted a basic binary file from in hex, so I imagine there might be an issue with binary files and this action.

FF 0F to EF BF BD 0F

I also ran into an issue with a larger binary file, when using an image of about 960kb ran into the following error:
stdout maxBuffer length exceeded

Some test runs:

GitHub rate limit triggered when syncing a lot of repositories

๐Ÿž Describe the bug

When executing the repo-file-sync-action in my workflow, it shows as successfully having completed but the logs show multiple instances of the following error:

Error: You have triggered an abuse detection mechanism and have been temporarily blocked from content creation. Please retry your request again later.

Each time this error is reported, the PR fails to be created. For example:

Repository Info
Slug		: jellyfish-queue
Owner		: product-os
Https Url	: https://github.com/product-os/jellyfish-queue
Branch		: default
	
Locally syncing file(s) between source and target repository
Pushing changes to target repository
Creating new PR
Error: You have triggered an abuse detection mechanism and have been temporarily blocked from content creation. Please retry your request again later.
Error: HttpError: You have triggered an abuse detection mechanism and have been temporarily blocked from content creation. Please retry your request again later.

No PR is created on the jellyfish-queue repo.

๐Ÿ“š To Reproduce

Create a sync.yml file that should result in PRs being created on a lot (about 20) of repos.

๐Ÿ’ก Expected behavior

No errors logged, all expected PRs successfully created.

๐Ÿ–ผ๏ธ Screenshots

N/A

โš™๏ธ Environment

  • Action version: 1.7.0

๐Ÿ“‹ Additional context

I'm not sure if this means the GitHub user associated with GH_PAT has been rate-limited or whether repo-file-sync-action or the workflow itself has been rate-limited?

Either way, I wonder if it would help to add a RATE_LIMIT option or similar that could be used to throttle the action's requests to the GitHub API to mitigate this error?

GitHub Actions: Transitioning from Node 16 to Node 20

๐Ÿž Describe the bug

Node 16 has reached its end of life, prompting us to initiate its deprecation process for GitHub Actions. Our plan is to transition all actions to run on Node 20 by Spring 2024. We will actively monitor the migration's progress and gather community feedback before finalizing the transition date. Starting October 23rd, workflows containing actions running on Node 16 will display a warning to alert users about the upcoming migration.

https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/

๐Ÿ“š To reproduce

Use the action

๐Ÿ’ก Expected behavior

No deprecation warning

๐Ÿ–ผ๏ธ Screenshots

No response

โš™๏ธ Environment

1.21.0

๐Ÿ“‹ Additional context

No response

Template rendering doesn't work alongside `dest`

๐Ÿž Describe the bug

It seems as though when you want to use the Jinja templating, you cannot specify the dest keyword in the config alongside template

๐Ÿ“š To reproduce

Set the sync.yml file to:

project/repo_1:
  - source: folder/file.py
    dest: file.py
    template:
      name: dale

Then the file.py file will incorrectly be rendered as:

name = {{ name }}

๐Ÿ’ก Expected behavior

I'd like to set the sync.yml file as:

project/repo_1:
  - source: folder/file.py
    dest: another_folder/file.py
    template:
      name: dale

Which will be rendered as:

name = dale

This file will live in another_folder/file.py in the destination repo. Currently, if you remove dest from the config, then it will render the output correctly, however it will sync it to the wrong path in the destination repo.

๐Ÿ–ผ๏ธ Screenshots

No response

โš™๏ธ Environment

v1

๐Ÿ“‹ Additional context

This does work for a non-python example:

project/repo_1:
  - source: folder/file.yml
    dest: another_folder/file.yml
    template:
      name: dale

Invalid PR branch when used in repos with a leading dot

๐Ÿž Describe the bug

When trying to use the action from a repo whose name starts with a dot like .github (community health files), it fails with git errors when it tries to create the PR branch:

Error: Error: Command failed: git checkout -b "repo-sync/.github/default"
fatal: 'repo-sync/.github/default' is not a valid branch name.

๐Ÿ“š To Reproduce

Use the action in a repo whose name wouldn't be a valid Git branch.

๐Ÿ’ก Expected behavior

Invalid characters in names should be filtered out.

๐Ÿ–ผ๏ธ Screenshots

If applicable, add screenshots to help explain your problem.

โš™๏ธ Environment

  • Action version: v.1.5.0

๐Ÿ“‹ Additional context

Alternatively it would be great to be able to specify the name of the branch, or the branch suffix.

Weird behavior when syncing two directories

๐Ÿž Describe the bug

I noticed a weird behavior when trying to sync two directories like this:

user/repo:
  - source: .github/ISSUE_TEMPLATE/
    dest: issues/

If issues/ already exists, the files from .github/ISSUE_TEMPLATE/ end up in issues/ISSUE_TEMPLATE/ instead of in issues/ as you would expect.

After investigating I found that the package used to copy files in this action, @actions/io, creates a new folder from the basename of the source path and copys the source files into it when the target directory already exists.

Here are the lines responsible for this behavior:

  // If dest is an existing directory, should copy inside.
  const newDest: string =
    destStat && destStat.isDirectory()
      ? path.join(dest, path.basename(source))
      : dest

From: https://github.com/actions/toolkit/blob/4dd900dde00dcc90e5c649b688c643b1fc7684a2/packages/io/src/io.ts#L47-L51

๐Ÿ“‹ Additional context

I filed an issue (#741) in GitHub's Actions Toolkit repo and will wait a bit for their response. If this doesn't get addressed in a reasonable amount of time I will use another library, or the shell directly, to copy files/directories in this action.

Please let me know if you run into this problem as well or if you have another idea for a solution. Thanks!

Rate limit exceeded during pull-request

๐Ÿž Describe the bug

Appears that when attempting to sync many repos github may throttle the number of pull-requests that can be made and will result in only partially completing the full list.

...
Locally syncing file(s) between source and target repository
Source is directory
Pushing changes to target repository
Creating new PR
Error: You have exceeded a secondary rate limit and have been temporarily blocked from content creation. Please retry your request again later.
Error: HttpError: You have exceeded a secondary rate limit and have been temporarily blocked from content creation. Please retry your request again later.
Repository Info
Slug		: client-config
Owner		: acme-corp
Https Url	: https://github.com/acme-corp/client-config
Branch		: master
	
Locally syncing file(s) between source and target repository
Source is directory
Pushing changes to target repository
Creating new PR
Error: You have exceeded a secondary rate limit and have been temporarily blocked from content creation. Please retry your request again later.
Error: HttpError: You have exceeded a secondary rate limit and have been temporarily blocked from content creation. Please retry your request again later.
Repository Info
Slug		: app-config
Owner		: acme-corp
Https Url	: https://github.com/acme-corp/app-config
Branch		: master
	
Locally syncing file(s) between source and target repository
Source is directory
Pushing changes to target repository
Creating new PR
Error: You have exceeded a secondary rate limit and have been temporarily blocked from content creation. Please retry your request again later.
Error: HttpError: You have exceeded a secondary rate limit and have been temporarily blocked from content creation. Please retry your request again later.
Repository Info
Slug		: api-config
Owner		: acme-corp
Https Url	: https://github.com/acme-corp/api-config
Branch		: master
...
...

๐Ÿ“š To Reproduce

Perform many syncs within one of the limits. Could be x per hour or x per minute.

๐Ÿ’ก Expected behavior

Either fast-fail and exit non-zero or retry after 5-10 seconds as per some (additional) action input. The action shouldn't indicate that it was successful if it didn't actually perform all the updates in the config (sync.yml).

๐Ÿ–ผ๏ธ Screenshots

image

notice the matrix shows 12 jobs, but my sync.yml has 20 repos listed.

image

โš™๏ธ Environment

๐Ÿ“‹ Additional context

Add any other context about the problem here.

Security Contact - missing

๐Ÿž Describe the bug

Hello,

I would like to report a security vulnerability in private, I was not able to find a security contact for this repository and there is no security policy and private reporting is disabled as well. What would be a good contact to reach out to? Or would you be open to enabling Github's private vulnerability reporting for the repository?

๐Ÿ“š To reproduce

N/A

๐Ÿ’ก Expected behavior

N/A

๐Ÿ–ผ๏ธ Screenshots

No response

โš™๏ธ Environment

v1.17

๐Ÿ“‹ Additional context

No response

Action not marked as failed if an error occurs

๐Ÿž Describe the bug

The actions run is marked as success even though an error occurred.

๐Ÿ“š To Reproduce

Use an invalid token, or a token which does not have correct access.

๐Ÿ’ก Expected behavior

The workflow run should be marked as failed.

๐Ÿ–ผ๏ธ Screenshots

See
https://github.com/Nef10/swift-package-common/actions/runs/1178374879
https://github.com/Nef10/swift-package-common/actions/runs/1178388705

โš™๏ธ Environment

BetaHuhn/repo-file-sync-action@v1

Missing escaping

๐Ÿž Describe the bug

E.g. when using `id` in the commit message the string is not correctly escaped and thus being replaced. See this commit which synced to this with the ORIGINAL_MESSAGE flag on.

๐Ÿ“š To Reproduce

Include `something` in a commit message and sync with the ORIGINAL_MESSAGE flag.

๐Ÿ’ก Expected behavior

The string should not be changed.

๐Ÿ–ผ๏ธ Screenshots

See links above.

โš™๏ธ Environment

Latest v1.

Problem setting git username/email with GH_PAT only

๐Ÿž Describe the bug

Our sync action stopped working ~5 days ago (seemingly after this was merged - #153). Throwing an error that the git username/email was missing.

We're passing only a GH_PAT, not an installation token.

๐Ÿ–ผ๏ธ Screenshots

image

See last working run: https://github.com/nextauthjs/next-auth/actions/runs/1809749953
Failing run: https://github.com/nextauthjs/next-auth/actions/runs/1815281481

๐Ÿ“‹ Additional context

Sync action: https://github.com/nextauthjs/next-auth/blob/main/.github/workflows/sync-example.yml
Sync config: https://github.com/nextauthjs/next-auth/blob/main/.github/sync.yml

sporadic "Server Error" on adding labels

๐Ÿž Describe the bug

We have sporadic "Server Error" messages (and therefore failed pipelines) when the action is trying to set labels.
The label does exist in the downstream repo.
It's also not a permission issue, as we tried different levels of access tokens, all with the same result.

We are syncing a fairly large sync list (currently ~100 repositories)

Personal hunch: Could it be that we are hitting GitHub API rate limiting?

๐Ÿ“š To reproduce

- name: Run GitHub File Sync
  uses: BetaHuhn/[email protected]
  with:
    GH_PAT: ${{ secrets.PAT }}
    COMMIT_EACH_FILE: false
    PR_LABELS: |
      sync
    COMMIT_PREFIX: "sync: "
    ORIGINAL_MESSAGE: true
  • run this like 100 times with a change set, so a PR will be created/updated
  • (doesn't matter a if a downstream PR already exists or not)
  • (we tested it so far only with private repositories)

๐Ÿ’ก Expected behavior

No "Server Error" or at least a more meaningful debug message

๐Ÿ–ผ๏ธ Screenshots

No response

โš™๏ธ Environment

  • ubuntu-latest runner
  • latest release of the action (1.21.0 by the time of writing)

๐Ÿ“‹ Additional context

log output

Repository Info
Slug		: my-private-repo
Owner		: my-org
Https Url	: https://github.com/my-org/my-private-repo
Branch		: main
	
Found existing PR 392
Locally syncing file(s) between source and target repository
Source is directory
Pushing changes to target repository
Overwriting existing PR
Notice: Pull Request #392 created/updated: https://github.com/my-org/my-private-repo/pull/392
Adding label(s) "sync" to PR
Error: Server Error

Error: stdout maxBuffer length exceeded

๐Ÿž Describe the bug

Similar to #174 but using the latest available version (v1.17.21 at the time of writing this).

When running the action across a number of a repos, several return the error Error: stdout maxBuffer length exceeded.

With debug logging enabled:

##[debug]EXEC: "git ls-tree -r --full-tree f90ff334cb91728ae54ce0311e374dda2d904ccc" IN tmp-1664748747018/github.com/sammcj/check-renamed-files-action@main
Error: stdout maxBuffer length exceeded
##[debug]{"code":"ERR_CHILD_PROCESS_STDIO_MAXBUFFER","cmd":"git ls-tree -r --full-tree f90ff334cb91728ae54ce0311e374dda2d904ccc"}
Repository Info
Slug		: github-app-installation-token
Owner		: sammcj
Https Url	: https://github.com/sammcj/github-app-installation-token

Repo: https://github.com/sammcj/check-renamed-files-action

๐Ÿ“š To reproduce

I believe you could fork https://github.com/sammcj/check-renamed-files-action and try syncing files to it.

๐Ÿ’ก Expected behavior

Not fail on error.

๐Ÿ–ผ๏ธ Screenshots

No response

โš™๏ธ Environment

v1.17.21

๐Ÿ“‹ Additional context

 ##[debug]CP: sync-files/dotfiles/actions-repos/.gitignore TO tmp-1664748747018/github.com/sammcj/check-renamed-files-action@main/.gitignore
##[debug]EXEC: "git add -f ".gitignore"" IN tmp-1664748747018/github.com/sammcj/check-renamed-files-action@main
##[debug]EXEC: "git status --porcelain" IN tmp-1664748747018/github.com/sammcj/check-renamed-files-action@main
##[debug]Creating commit for file(s) .gitignore
##[debug]EXEC: "git commit -m 'chore: Sync Files - 2022/10/02 -- [bot] Synced local '\''.gitignore'\'' with remote '\''sync-files/dotfiles/actions-repos/.gitignore'\'''" IN tmp-1664748747018/github.com/sammcj/check-renamed-files-action@main
##[debug]EXEC: "git status --porcelain" IN tmp-1664748747018/github.com/sammcj/check-renamed-files-action@main
Pushing changes to target repository
##[debug]EXEC: "git log --format=%H --reverse main..HEAD" IN tmp-1664748747018/github.com/sammcj/check-renamed-files-action@main
##[debug]EXEC: "git log -1 --format=%B f90ff334cb91728ae54ce0311e374dda2d904ccc" IN tmp-1664748747018/github.com/sammcj/check-renamed-files-action@main
##[debug]EXEC: "git ls-tree -r --full-tree f90ff334cb91728ae54ce0311e374dda2d904ccc" IN tmp-1664748747018/github.com/sammcj/check-renamed-files-action@main
##[debug]Creating missing blobs on GitHub
##[debug]EXEC: "git ls-tree -r --full-tree f90ff334cb91728ae54ce0311e374dda2d904ccc~1" IN tmp-1664748747018/github.com/sammcj/check-renamed-files-action@main
##[debug]EXEC: "git ls-tree -r --full-tree f90ff334cb91728ae54ce0311e374dda2d904ccc" IN tmp-1664748747018/github.com/sammcj/check-renamed-files-action@main
Error: stdout maxBuffer length exceeded
##[debug]{"code":"ERR_CHILD_PROCESS_STDIO_MAXBUFFER","cmd":"git ls-tree -r --full-tree f90ff334cb91728ae54ce0311e374dda2d904ccc"}
Repository Info
Slug		: github-app-installation-token
Owner		: sammcj
Https Url	: https://github.com/sammcj/github-app-installation-token
Branch		: main

Actions fail in v1.17.18

๐Ÿž Describe the bug

After this merge, our workflows failed.
Look at the screenshots.

๐Ÿ“š To Reproduce

  • Having a working configuration
  • Update the action version to v1.17.18
  • Run the sync workflow

๐Ÿ’ก Expected behavior

Works like version v1.17.17

๐Ÿ–ผ๏ธ Screenshots

Action trace screenshot

failed

As seen in the commit screenshot.

commit

  • We made a change in PR-110. We added the variable BRANCH_PREFIX: 'admin/sync/actions' for the Sync common GitHub Actions workflow, but as you can see, all of them failed, not just the modified workflow.
  • We made a PR-111 to put the version v1.17.17 and everything worked fine.

โš™๏ธ Environment

๐Ÿ“‹ Additional context

  • After the rollback to version v1.17.17 everything worked fine.
  • cc: @gomete

Cannot set commit message as the title of the PR

๐Ÿž Describe the bug

I am triggering the action by pushing only 1 commit to test branch. But the PR title remains the default one:
Synced file(s) with user/repo name.

My workflow file:

    on:
      push:
        branches:
          - test
      workflow_dispatch:
    jobs:
      sync:
        runs-on: ubuntu-latest
        steps:
          - name: Checkout Repository
            uses: actions/checkout@v2
    
          - name: Generate token
            id: generate_token
            uses: tibdex/github-app-token@v1
            with:
              app_id: xxxxxx
              private_key: ${{ secrets.PRIVATE_KEY }}
    
          - name: Run GitHub File Sync
            uses: BetaHuhn/[email protected]
            with:
              GH_INSTALLATION_TOKEN: ${{ steps.generate_token.outputs.token }}
              ORIGINAL_MESSAGE: true
              COMMIT_AS_PR_TITLE: true
              GIT_EMAIL: [email protected]
              GIT_USERNAME: test

๐Ÿ“š To reproduce

Create a test repo source and dest, use the action and above configuration.

๐Ÿ’ก Expected behavior

Created PR having my commit message as its title.

๐Ÿ–ผ๏ธ Screenshots

No response

โš™๏ธ Environment

v1.21.17
tested also in previous versions

๐Ÿ“‹ Additional context

No response

Deletion of a file does not trigger the sync action.

๐Ÿž Describe the bug

Deletion of a file does not trigger the sync action.

๐Ÿ“š To Reproduce

  1. Configure repo sync action on a particular directory
  2. Add some files there.
  3. Delete one of the files.

๐Ÿ’ก Expected behavior

A new PR opened with file deletion.

๐Ÿ–ผ๏ธ Screenshots

If applicable, add screenshots to help explain your problem.

โš™๏ธ Environment

  • Action version: [e.g. v1.0.0]

๐Ÿ“‹ Additional context

Add any other context about the problem here.

Error: Cannot create a new GitHub Tree: Server Error

๐Ÿž Describe the bug

Hello when I am trying to use the action with a GitHub App, I am having this error. Any help is appreciated.

๐Ÿ“š To reproduce

๐Ÿ’ก Expected behavior

A PR against the specified branch to be created.

๐Ÿ–ผ๏ธ Screenshots

image

image

โš™๏ธ Environment

@v1

๐Ÿ“‹ Additional context

No response

Error when sync an empty file

๐Ÿž Describe the bug

When synchronize a file which is empty I have the following errors :

Synchronize Files
Cannot read property 'startsWith' of undefined

Synchronize Files
TypeError: Cannot read property 'startsWith' of undefined

๐Ÿ“š To Reproduce

Create a file with no content.
I created an empty docker-compose.yaml file

๐Ÿ’ก Expected behavior

I expected to have my file syncronized

๐Ÿ–ผ๏ธ Screenshots

โš™๏ธ Environment

  • Action version: [e.g. v1.0.0]

๐Ÿ“‹ Additional context

Add any other context about the problem here.

Syncing through forked repo hits "shallow update not allowed" after the first pull request is merged into target repo

๐Ÿž Describe the bug

I synced with FORK parameter referring to Fork and pull request workflow.
The action could successfully create the first pull request targeting to the target repo through forked repo. Once the first pull request is merged, when I push some change to the sync file next time in source repo the action run failed due to shallow update not allowed error, like https://github.com/GangWang01/Experiment/actions/runs/3443890910.
The error is a result of main branch of forked repo is some commits behind target repo. To work around this problem, I have to manually sync forked repo from its upstream(the target repo). However it doesn't make sense for the purpose of this action.

BTW, ORIGINAL_MESSAGE and COMMIT_AS_PR_TITLE don't work when syncing file through forked repo.

๐Ÿ“š To reproduce

  1. https://github.com/GangWang01/Experiment is the source repo and it's configured to use this action with FORK parameter. This is my own repo I have write access.
  2. https://github.com/JaynieBai/ManageTestResults is the target repo. I don't have write access to it.
  3. Merge the first pull request created by the action.
  4. Push some change to the file that needs to sync to source repo. Then check if the run fails with the error.

๐Ÿ’ก Expected behavior

It's very helpful syncing through forked repo could work well.

๐Ÿ–ผ๏ธ Screenshots

No response

โš™๏ธ Environment

Neither BetaHuhn/repo-file-sync-action@v1 nor BetaHuhn/repo-file-sync-action@latest works.

๐Ÿ“‹ Additional context

No response

Keep creating empty PRs after each push

๐Ÿž Describe the bug

Hello,

I really loved the idea and integrated my project into repo-file-sync-action. Just realized that I am having empty PRs with 2 comits but no change. For example, the PR here: SubMob/LogMob#115

How to avoid creating PRs if nothing changed ?

I thought if I merge one of the empty PR then it will no longer create (since the 2 commits would be merged) but no luck, I actually merged one of these PRs, but new ones are keep coming. For example in the same repo I had this PR: SubMob/LogMob#113 and merged it, but it didn't fix the situation.

๐Ÿ“š To reproduce

Not sure how you can reproduce this, but I put an example of the PRs, maybe you can see the logs, and I am willing to do anything you might think helpful

๐Ÿ’ก Expected behavior

If there is no diff, no PR should be created.

๐Ÿ–ผ๏ธ Screenshots

No response

โš™๏ธ Environment

1.21.0, latest

๐Ÿ“‹ Additional context

No response

Command failed: git ls-tree -r --full-tree

๐Ÿž Describe the bug

The actions fails with Error: Command failed: git ls-tree -r --full-tree

๐Ÿ“š To Reproduce

Please see my config here:

๐Ÿ’ก Expected behavior

Should sync correctly.

๐Ÿ“„ Logs

The run is here: https://github.com/Nef10/swiftlint-config/runs/6332482552?check_suite_focus=true

Debug Log
2022-05-07T05:34:10.0592535Z ##[debug]Loading env
2022-05-07T05:34:10.0599012Z ##[group]Run BetaHuhn/repo-file-sync-action@v1
2022-05-07T05:34:10.0599458Z with:
2022-05-07T05:34:10.0600044Z   GH_INSTALLATION_TOKEN: ***
2022-05-07T05:34:10.0600547Z   GIT_EMAIL: 89714990+file-sync-app[bot]@users.noreply.github.com
2022-05-07T05:34:10.0601085Z   GIT_USERNAME: file-sync-app[bot]
2022-05-07T05:34:10.0601517Z   ORIGINAL_MESSAGE: true
2022-05-07T05:34:10.0601931Z   COMMIT_EACH_FILE: false
2022-05-07T05:34:10.0602326Z   SKIP_PR: true
2022-05-07T05:34:10.0602709Z ##[endgroup]
2022-05-07T05:34:10.2341759Z ::add-mask::***
2022-05-07T05:34:10.2347320Z ##[debug]{
2022-05-07T05:34:10.2348036Z ##[debug]  "GITHUB_TOKEN": "***",
2022-05-07T05:34:10.2348680Z ##[debug]  "IS_INSTALLATION_TOKEN": true,
2022-05-07T05:34:10.2349236Z ##[debug]  "GIT_EMAIL": "89714990+file-sync-app[bot]@users.noreply.github.com",
2022-05-07T05:34:10.2349812Z ##[debug]  "GIT_USERNAME": "file-sync-app[bot]",
2022-05-07T05:34:10.2350290Z ##[debug]  "CONFIG_PATH": ".github/sync.yml",
2022-05-07T05:34:10.2350721Z ##[debug]  "COMMIT_BODY": "",
2022-05-07T05:34:10.2351162Z ##[debug]  "COMMIT_PREFIX": "๐Ÿ”„",
2022-05-07T05:34:10.2351583Z ##[debug]  "COMMIT_EACH_FILE": false,
2022-05-07T05:34:10.2352005Z ##[debug]  "PR_LABELS": [
2022-05-07T05:34:10.2352387Z ##[debug]    "sync"
2022-05-07T05:34:10.2352744Z ##[debug]  ],
2022-05-07T05:34:10.2353107Z ##[debug]  "PR_BODY": "",
2022-05-07T05:34:10.2353517Z ##[debug]  "TMP_DIR": "tmp-1651901650229",
2022-05-07T05:34:10.2353941Z ##[debug]  "DRY_RUN": false,
2022-05-07T05:34:10.2354339Z ##[debug]  "SKIP_CLEANUP": false,
2022-05-07T05:34:10.2354763Z ##[debug]  "OVERWRITE_EXISTING_PR": true,
2022-05-07T05:34:10.2355255Z ##[debug]  "GITHUB_REPOSITORY": "Nef10/swiftlint-config",
2022-05-07T05:34:10.2355717Z ##[debug]  "SKIP_PR": true,
2022-05-07T05:34:10.2356115Z ##[debug]  "ORIGINAL_MESSAGE": true,
2022-05-07T05:34:10.2356849Z ##[debug]  "COMMIT_AS_PR_TITLE": false,
2022-05-07T05:34:10.2357326Z ##[debug]  "BRANCH_PREFIX": "repo-sync/SOURCE_REPO_NAME",
2022-05-07T05:34:10.2357785Z ##[debug]  "FORK": false
2022-05-07T05:34:10.2358343Z ##[debug]}
2022-05-07T05:34:10.2466685Z Repository Info
2022-05-07T05:34:10.2491513Z Slug		: common-swift-package
2022-05-07T05:34:10.2492197Z Owner		: Nef10
2022-05-07T05:34:10.2493240Z Https Url	: https://github.com/Nef10/common-swift-package
2022-05-07T05:34:10.2494526Z Branch		: default
2022-05-07T05:34:10.2494887Z 	
2022-05-07T05:34:10.2495904Z ##[debug]Cloning github.com/Nef10/common-swift-package into tmp-1651901650229/github.com/Nef10/common-swift-package@default
2022-05-07T05:34:10.2497824Z ##[debug]EXEC: "git clone --depth 1  ***github.com/Nef10/common-swift-package.git tmp-1651901650229/github.com/Nef10/common-swift-package@default" IN undefined
2022-05-07T05:34:10.4376154Z ##[debug]Setting git user to email: 89714990+file-sync-app[bot]@users.noreply.github.com, username: file-sync-app[bot]
2022-05-07T05:34:10.4377739Z ##[debug]EXEC: "git config --local user.name "file-sync-app[bot]" && git config --local user.email "89714990+file-sync-app[bot]@users.noreply.github.com"" IN tmp-1651901650229/github.com/Nef10/common-swift-package@default
2022-05-07T05:34:10.4452994Z ##[debug]EXEC: "git rev-parse --abbrev-ref HEAD" IN tmp-1651901650229/github.com/Nef10/common-swift-package@default
2022-05-07T05:34:10.4509802Z ##[debug]EXEC: "git rev-parse HEAD" IN tmp-1651901650229/github.com/Nef10/common-swift-package@default
2022-05-07T05:34:10.4537622Z Locally syncing file(s) between source and target repository
2022-05-07T05:34:10.4549900Z ##[debug]CP: .swiftlint.yml TO tmp-1651901650229/github.com/Nef10/common-swift-package@default/.swiftlint.yml
2022-05-07T05:34:10.4573152Z ##[debug]EXEC: "git add -f ".swiftlint.yml"" IN tmp-1651901650229/github.com/Nef10/common-swift-package@default
2022-05-07T05:34:10.4617424Z ##[debug]EXEC: "git status --porcelain" IN tmp-1651901650229/github.com/Nef10/common-swift-package@default
2022-05-07T05:34:10.4664237Z ##[debug]Creating commit for remaining files
2022-05-07T05:34:10.7047389Z ##[debug]EXEC: "git diff HEAD .swiftlint.yml" IN tmp-1651901650229/github.com/Nef10/common-swift-package@default
2022-05-07T05:34:10.7110507Z ##[debug]EXEC: "git commit -m 'Update SwiftLint rules for 0.47.1'" IN tmp-1651901650229/github.com/Nef10/common-swift-package@default
2022-05-07T05:34:10.7189949Z Pushing changes to target repository
2022-05-07T05:34:10.7191456Z ##[debug]EXEC: "git log --format=%H --reverse main..HEAD" IN tmp-1651901650229/github.com/Nef10/common-swift-package@default
2022-05-07T05:34:10.7244940Z ##[debug]EXEC: "git log -1 --format=%B " IN tmp-1651901650229/github.com/Nef10/common-swift-package@default
2022-05-07T05:34:10.7268692Z ##[debug]EXEC: "git ls-tree -r --full-tree " IN tmp-1651901650229/github.com/Nef10/common-swift-package@default
2022-05-07T05:34:10.7283222Z ##[debug]Creating missing blobs on GitHub
2022-05-07T05:34:10.7284569Z ##[debug]EXEC: "git ls-tree -r --full-tree ~1" IN tmp-1651901650229/github.com/Nef10/common-swift-package@default
2022-05-07T05:34:10.7307442Z ##[debug]EXEC: "git ls-tree -r --full-tree " IN tmp-1651901650229/github.com/Nef10/common-swift-package@default
2022-05-07T05:34:10.7353249Z ##[error]Command failed: git ls-tree -r --full-tree 
usage: git ls-tree [<options>] <tree-ish> [<path>...]

    -d                    only show trees
    -r                    recurse into subtrees
    -t                    show trees when recursing
    -z                    terminate entries with NUL byte
    -l, --long            include object size
    --name-only           list only filenames
    --name-status         list only filenames
    --object-only         list only objects
    --full-name           use full path names
    --full-tree           list entire tree; not just current directory (implies --full-name)
    --format <format>     format to use for the output
    --abbrev[=<n>]        use <n> digits to display object names


2022-05-07T05:34:10.7363115Z ##[debug]{"killed":false,"code":129,"signal":null,"cmd":"git ls-tree -r --full-tree "}

๐Ÿ“‹ Additional context

Last ran synced correctly with the same config on Jan 22.

Allow configuring parameters for Nunjucks

๐Ÿž Describe the bug

Currently some configuration options for Nunjucks are hardcoded into the action.

nunjucks.configure({ autoescape: true, trimBlocks: true, lstripBlocks: true })

These can be incompatible with the needs of a project. For example, in a YAML project, autoescape can cause single quotes (') to be replaced with HTML entity codes (&#39;).

๐Ÿ“š To reproduce

Use a template-based approach to write YAML containing single quotes.

๐Ÿ’ก Expected behavior

Nunjucks should be configurable by setting some options on the action that are passed into the nunjucks.configure function.

๐Ÿ–ผ๏ธ Screenshots

No response

โš™๏ธ Environment

v1.18.0

๐Ÿ“‹ Additional context

I'd be happy to open a PR to resolve this.

sync a folder with deleteOrphaned fail to really delete files

๐Ÿž Describe the bug

I have a folder synchronized from the origin repo to the destination one with the deleteOrphaned setting enabled.
If some files are added in this folder in the destination repo (or already exist before first sync) they are not deleted.
In the same idea, if we delete the folder from the origin repo, we have no way to delete folder in the destination repo.

got these errors in logs :

Error: Cannot read property 'includes' of undefined
Error: TypeError: Cannot read property 'includes' of undefined

๐Ÿ’ก Expected behavior

Some way to really sync folder between repos. ie delete all existing files if not in the root folder, and some way to delete a folder.

โš™๏ธ Environment

  • Action version: v1

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.