tgymnich / fork-sync Goto Github PK
View Code? Open in Web Editor NEWπ Github action to sync your forks
License: MIT License
π Github action to sync your forks
License: MIT License
response: {
url: 'https://api.github.com/repos/kiranshahavi/blogdata/pulls',
status: 422,
headers: {
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
connection: 'close',
'content-length': '223',
'content-security-policy': "default-src 'none'",
'content-type': 'application/json; charset=utf-8',
date: 'Thu, 13 Oct 2022 10:40:51 GMT',
'github-authentication-token-expiration': '2022-11-12 10:31:26 UTC',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
vary: 'Accept-Encoding, Accept, X-Requested-With',
'x-accepted-oauth-scopes': '',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-media-type': 'github.v3; format=json',
'x-github-request-id': 'FBF7:0F00:7A846:84170:6347EB33',
'x-oauth-scopes': 'admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages',
'x-ratelimit-limit': '5000',
'x-ratelimit-remaining': '4982',
'x-ratelimit-reset': '1665659290',
'x-ratelimit-resource': 'core',
'x-ratelimit-used': '18',
'x-xss-protection': '0'
},
data: {
message: 'Validation Failed',
errors: [Array],
documentation_url: 'https://docs.github.com/rest/reference/pulls#create-a-pull-request'
}
},
request: {
method: 'POST',
url: 'https://api.github.com/repos/kiranshahavi/blogdata/pulls',
headers: {
accept: 'application/vnd.github.v3+json',
'user-agent': 'octokit.js/2.0.8 octokit-core.js/4.1.0 Node.js/16.13.0 (win32; x64)',
authorization: 'token [REDACTED]',
'content-type': 'application/json; charset=utf-8'
},
body: '{"owner":"kiranshahavi","repo":"blogdata","head":"master","base":"master"}',
request: { hook: [Function: bound bound register] }
}
}
DEBUG2 HttpError: Validation Failed: {"resource":"PullRequest","code":"custom","message":"No commits between master and master"}
at C:\Git\uploadserverfiles\node_modules@octokit\request\dist-node\index.js:88:21
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Job.doExecute (C:\Git\uploadserverfiles\node_modules\bottleneck\light.js:405:18)
Hello!
Disclaimer: your action itself works great and this might be a layer 8 issue.
I'm contributing from time to time to a project on GitHub. So I forked it and set up your action to keep it updated. But when I create I pull request it will always include the configuration .yml which isn't needed in the original project. I've tried to add it to a branch but that prevents it from showing up in the GitHub actions.
Is there any other way besides removing the file each time before committing?
I think I misinterpret the meaning of owner
.
I am trying to sync not just from upstream -> fork
but between fork-A and fork-B in different orgs.
Syncing kaovilai/velero
main
with vmware-tanzu/velero:main
release-1.9
with vmware-tanzu/velero:release-1.9
oadp-1.0
with openshift/velero:oadp-1.0
See my workflow
Is this possible with this action?
Since a few days ago, I'm getting this error message. Here is the debug trace:
name: "Sync with original repo - action"
#https://github.com/marketplace/actions/fork-sync
on:
schedule:
- cron: '0 16 * * 1,4'
workflow_dispatch: # on button click
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: tgymnich/[email protected]
with:
owner: mikecao
github_token: ${{ secrets.GITHUB_TOKEN }}
personal_token: ${{ secrets.GH_PERSONAL_TOKEN }}
head: master
base: production
merge_method: merge
pr_title: Fork Sync
auto_approve: true
I have a private repo in a different github org I am only a collaborator in, forked by my own private repo.
When I attempt to run the workflow I get not all refs are readable error.
request: {
method: 'POST',
url: 'https://api.github.com/repos/my-user/my-repo/pulls',
headers: {
accept: 'application/vnd.github.v3+json',
'user-agent': 'octokit.js/16.30.1 Node.js/12.13.1 (Linux 5.0; x64)',
authorization: 'token [REDACTED]',
'content-type': 'application/json; charset=utf-8'
},
body: '{"title":"Fork Sync","head":"otherorg:master","base":"master","body":"","merge_method":"rebase","maintainer_can_modify":false}',
request: { hook: [Function: bound bound register], validate: [Object] }
},
errors: [
{
resource: 'PullRequest',
code: 'custom',
message: 'not all refs are readable'
}
],
Hey i'm looking for a workflow that does not require a PR to be made, i just want it to sync like if i was doing it manually but automatic, any way to do that with this workflow or do i need to use another one or is there at least plans on implementing a solution without PRs
That way we do not have to indiscriminately ignore all failures.
Github is warning:
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: tgymnich/[email protected]. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
Is it possible to set up an email notification when Fork Sync finds new changes to be synced?
According to Notifications for workflow runs, I can set up a notification for a successful run of Fork Sync. However, I would like to distinguish between a successful run in which nothing happens (since there are no new changes to merge), and a successful run where new changes were detected and merged. I would like to get notifications only for the latter.
How can I achieve that?
Additional details: I could subscribe for pull requests events, but since the Fork Sync workflow operates under my user, I suppose that GitHub suppresses the notification (under the assumption that a user doesn't need to be notified about his own actions).
I'm planning on using this action to lower the risk associated to GitHub Actions we are using in my company.
Basically, referencing an external action in our actions, such as: uses: rlespinasse/[email protected]
might result in fatal failure if the repository owner (rlespinasse
in this case) would delete their repository from GitHub.
Also, referencing tags (e.g: v3.4
) isn't actually safe, as a repository could be hacked, or an error could be made, and a git tag could be changed to point to another commit containing malicious code. Therefore, forking a repository is the safest way of protecting our own work, by not relying on something that might break at any time, due to unforeseen and uncontrollable circumstances.
That's why I'm thinking to manually fork each action and use those forks, instead of using the real action. But then, keeping those forks up to date becomes a real pain.
That's where I'm thinking of using your work tgymnich/fork-sync
, to keep those forks up-to-date.
And I need to auto-update the fork based on the source's changes (which is supported), but I'd also need to auto-create the new tags, but not allow editing of existing tags (e.g v4.3.1
), unless they're allowed to be updated (e.g: v4.x
, v3
).
Is that something you might consider adding? I'm interested to know a bit better what's your personal use-case for using this action.
cfg with secrets.PERSONAL_TOKEN, Personal access tokens (classic) - repo, workflow
uses: tgymnich/fork-sync@v1
with:
owner: Aleksoid1978
repo: VideoRenderer
base: master
head: master
auto_approve: true
token: ${{ secrets.PERSONAL_TOKEN }}
cfg with secrets.GITHUB_TOKEN
uses: tgymnich/fork-sync@v1
with:
owner: Aleksoid1978
repo: VideoRenderer
base: master
head: master
auto_approve: true
token: ${{ secrets.GITHUB_TOKEN }}
error log
Run tgymnich/fork-sync@v1
with:
owner: Aleksoid1978
repo: VideoRenderer
base: master
head: master
auto_approve: true
token: ***
merge_method: merge
pr_title: Fork Sync: Update from parent repository
ignore_fail: false
auto_merge: true
retries: 4
retry_after: 60
request failed after 4 retries with a delay of 60
Error: Failed to create or merge pull request: HttpError: Unprocessable Entity: "Can not approve your own pull request"
Allow auto-merge is select
my repo: https://github.com/qwerttvv/MPC-VideoRenderer/
owner repo: https://github.com/Aleksoid1978/VideoRenderer
Invalid workflow file
You have an error in your yaml syntax on line 1
...yet I just copy - pasted your yaml from the marketplace. Is that github parser error ?
Steps to replicate :
copy and paste.
Based on #46 (comment) I think the Readme.md
should be updated now that #71 is merged and v1.6 is out, so the template example and docs should reflect the actual changes.
I would open a PR myself, but I cannot find anywhere what is the correct configuration with the current version
I have a project in my personal repo, which I have forked in my organisation repo. I just wanted to sync the build
branch of base with the gh-pages
branch of the head. This is the action file I am using:
name: Deploy
on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: TG908/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
owner: jalaj-k
head: gh-pages
base: build
And, I am getting this error:
Failed to create or merge pull request: HttpError: Validation Failed: {"resource":"PullRequest","field":"base","code":"invalid"}
What is this supposed to mean? What am I doing wrong? Or is this some bug? Or am i trying to do something that isn't possible?
I am syncing a fork of a private repo I have access to.
This is my yml file:
name: Sync Fork
on:
push:
schedule:
- cron: '*/3 * * * *'
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: TG908/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
base: '*'
head: '*'
But this is the error I see in my github actions log:
Check failure on line 1 in .github
@github-actions
github-actions
/ sync
.github#L1
Failed to create or merge pull request
what am I doing wrong? I need to sync ALL branches and tags from the original parent repo.
I keep getting the following error
Run TG908/[email protected]
##[error]Node run failed with exit code 1
Run TG908/[email protected]
##[error]Failed to create or merge PR unstable<-RedisLabs:unstable:Validation Failed
##[error]Node run failed with exit code 1
See:
https://github.com/RedisLabs/redis/commit/4d1bdf256ce4239eb09a200e6b326d2e61df6f1b/checks
I've this error :
2020-01-21T12:08:07.8503617Z RequestError [HttpError]: Validation Failed
2020-01-21T12:08:07.8504460Z at /home/runner/work/_actions/TG908/fork-sync/v1.1.5/node_modules/@octokit/request/dist-node/index.js:66:23
2020-01-21T12:08:07.8528521Z at processTicksAndRejections (internal/process/task_queues.js:93:5)
2020-01-21T12:08:07.8540899Z at async Job.doExecute (/home/runner/work/_actions/TG908/fork-sync/v1.1.5/node_modules/bottleneck/light.js:405:18) {
2020-01-21T12:08:07.8545446Z name: 'HttpError',
2020-01-21T12:08:07.8545832Z status: 422,
2020-01-21T12:08:07.8546033Z headers: {
2020-01-21T12:08:07.8547372Z 'access-control-allow-origin': '*',
2020-01-21T12:08:07.8548368Z 'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
2020-01-21T12:08:07.8554975Z connection: 'close',
2020-01-21T12:08:07.8555433Z 'content-length': '217',
2020-01-21T12:08:07.8555885Z 'content-security-policy': "default-src 'none'",
2020-01-21T12:08:07.8556226Z 'content-type': 'application/json; charset=utf-8',
2020-01-21T12:08:07.8556545Z date: 'Tue, 21 Jan 2020 12:08:07 GMT',
2020-01-21T12:08:07.8556915Z 'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
2020-01-21T12:08:07.8557235Z server: 'GitHub.com',
2020-01-21T12:08:07.8557667Z status: '422 Unprocessable Entity',
2020-01-21T12:08:07.8558012Z 'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
2020-01-21T12:08:07.8558294Z 'x-content-type-options': 'nosniff',
2020-01-21T12:08:07.8558937Z 'x-frame-options': 'deny',
2020-01-21T12:08:07.8559836Z 'x-github-media-type': 'github.v3; format=json',
2020-01-21T12:08:07.8560190Z 'x-github-request-id': '07C1:06D5:1375B4:310C51:5E26E9A7',
2020-01-21T12:08:07.8560459Z 'x-ratelimit-limit': '5000',
2020-01-21T12:08:07.8560940Z 'x-ratelimit-remaining': '4996',
2020-01-21T12:08:07.8561241Z 'x-ratelimit-reset': '1579609988',
2020-01-21T12:08:07.8561548Z 'x-xss-protection': '1; mode=block'
2020-01-21T12:08:07.8561662Z },
2020-01-21T12:08:07.8562002Z request: {
2020-01-21T12:08:07.8562294Z method: 'POST',
2020-01-21T12:08:07.8562770Z url: 'https://api.github.com/repos/Xstoudi/rtorrent_exporter/pulls',
2020-01-21T12:08:07.8562947Z headers: {
2020-01-21T12:08:07.8563274Z accept: 'application/vnd.github.v3+json',
2020-01-21T12:08:07.8563598Z 'user-agent': 'octokit.js/16.30.1 Node.js/12.13.1 (Linux 5.0; x64)',
2020-01-21T12:08:07.8563866Z authorization: 'token [REDACTED]',
2020-01-21T12:08:07.8564182Z 'content-type': 'application/json; charset=utf-8'
2020-01-21T12:08:07.8564435Z },
2020-01-21T12:08:07.8564836Z body: '{"title":"Fork Sync","head":"Xstoudi:master","base":"master","body":"","merge_method":"merge","maintainer_can_modify":false}',
2020-01-21T12:08:07.8565051Z request: { hook: [Function: bound bound register], validate: [Object] }
2020-01-21T12:08:07.8565167Z },
2020-01-21T12:08:07.8565310Z errors: [
2020-01-21T12:08:07.8565455Z {
2020-01-21T12:08:07.8565769Z resource: 'PullRequest',
2020-01-21T12:08:07.8566012Z code: 'custom',
2020-01-21T12:08:07.8566318Z message: 'No commits between master and master'
2020-01-21T12:08:07.8566474Z }
2020-01-21T12:08:07.8566616Z ],
2020-01-21T12:08:07.8567186Z documentation_url: 'https://developer.github.com/v3/pulls/#create-a-pull-request'
2020-01-21T12:08:07.8567381Z }
2020-01-21T12:08:07.8570570Z ##[error]Failed to create or merge pull request
2020-01-21T12:08:07.8583426Z ##[error]Node run failed with exit code 1
2022-09-28T19:52:13.5114911Z Download action repository 'tgymnich/[email protected]' (SHA:7360ab99c216620bcec5d1277f03b278fe3813e1)
2022-09-28T19:52:14.6990259Z ##[group]Run tgymnich/[email protected]
2022-09-28T19:52:14.6990690Z with:
2022-09-28T19:52:14.6990936Z owner: llvm
2022-09-28T19:52:14.6991218Z base: master
2022-09-28T19:52:14.6991474Z head: master
2022-09-28T19:52:14.6991952Z token: ***
2022-09-28T19:52:14.6992233Z merge_method: merge
2022-09-28T19:52:14.6992580Z pr_title: Fork Sync: Update from parent repository
2022-09-28T19:52:14.6992906Z ignore_fail: false
2022-09-28T19:52:14.6993186Z auto_approve: false
2022-09-28T19:52:14.6993465Z auto_merge: true
2022-09-28T19:52:14.6993712Z retries: 4
2022-09-28T19:52:14.6993970Z retry_after: 60
2022-09-28T19:52:14.6994261Z ##[endgroup]
2022-09-28T19:56:16.0648588Z (node:1567) UnhandledPromiseRejectionWarning: HttpError: Not Found
2022-09-28T19:56:16.0649598Z at /home/runner/work/_actions/tgymnich/fork-sync/v1.6.3/node_modules/@octokit/rest/node_modules/@octokit/request/dist-node/index.js:68:23
2022-09-28T19:56:16.0650183Z at processTicksAndRejections (internal/process/task_queues.js:97:5)
2022-09-28T19:56:16.0652736Z at async Job.doExecute (/home/runner/work/_actions/tgymnich/fork-sync/v1.6.3/node_modules/bottleneck/light.js:405:18)
2022-09-28T19:56:16.0655003Z (node:1567) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)
2022-09-28T19:56:16.0659310Z (node:1567) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
2022-09-28T19:56:16.0960156Z Cleaning up orphan processes
Are new tags from the uptream included in the sync? If not, is it possible to include this as a feature?
Thanks
Hey, i was wondering if it's possible to configure the action somehow to first create a new branch in my repository, merge upstream changes in there and then create a new PR from that branch into my base branch?
So basically what the action does today is:
create a new PR upstream/head -> fork/base
.
If it would do:
create a new branch PR-#<NR>
in fork, merge upstream/head -> PR-#<NR>
, create new PR PR-#<NR> -> fork/base
it would be much easier to for example add commits manually or resolve merge conflicts directly on the temporarily created branch.
If that's a missing feature which you also like to be implemented i'd really be looking forward in creating a draft for this π
https://github.com/NimaQu/BiliExp/runs/2199469267
I've tried looking into it. When the pull request contains changes to the workflow file, the merge will be blocked( this post: https://github.community/t/github-action-resource-not-accessible-by-integration/16034/3), so maybe we need to use the personal access token to perform the merge?
Hey,
The misconfigured workflow will mark the build passed despite the step being failed. (example):
Maybe we can catch that and core.setFailed(
)
&& process.exit(1)
? π€
A PR was opened but not automatically merged and I had to manually merge it
errors: [
{
resource: 'PullRequest',
code: 'custom',
message: 'A pull request already exists for antirez:unstable.'
}
I always get this error message and the PR isn't created at all. Could you give me a hint what's going wrong?
Here's the log file... (head branch name was edited for privacy reasons)
2020-12-21T20:28:18.0083431Z ##[group]Run tgymnich/[email protected]
2020-12-21T20:28:18.0084080Z with:
2020-12-21T20:28:18.0085256Z github_token: ***
2020-12-21T20:28:18.0085780Z base: fm-sys:master
2020-12-21T20:28:18.0086262Z head: <name of original owner>:master
2020-12-21T20:28:18.0086806Z pr_title: Update Fork
2020-12-21T20:28:18.0087264Z merge_method: merge
2020-12-21T20:28:18.0087690Z auto_approve: false
2020-12-21T20:28:18.0088143Z ##[endgroup]
2020-12-21T20:32:20.6346723Z request failed after 4 retries with a delay of 60
2020-12-21T20:32:20.6356377Z ##[error]Failed to create or merge pull request: HttpError: Validation Failed: {"resource":"PullRequest","field":"base","code":"invalid"}
Hi! First thanks for your job. I'm facing a strange issue here that I cannot get rid of. I finally achieved to get the workflow running as it is creating a PR to Sync the repo. However, PR won't be automerged and the GitHub Actions will fail. I tried two different configs, with different errors:
Config 1:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: tgymnich/[email protected]
with:
owner: mikecao
token: ${{ secrets.GH_PERSONAL_TOKEN }} # with public repo access
head: master
base: production
merge_method: merge
pr_title: Fork Sync
auto_approve: true
Error 1:
Run tgymnich/[email protected]
with:
owner: mikecao
token: ***
head: master
base: production
merge_method: merge
pr_title: Fork Sync
auto_approve: true
request failed after 4 retries with a delay of 60
Error: Failed to create or merge pull request: HttpError: Unprocessable Entity: "Can not approve your own pull request"
Config 2:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: tgymnich/[email protected]
with:
owner: mikecao
token: ${{ secrets.GITHUB_TOKEN }} # not my personal token
head: master
base: production
merge_method: merge
pr_title: Fork Sync
Error 2:
Run tgymnich/[email protected]
with:
owner: mikecao
token: ***
head: master
base: production
merge_method: merge
pr_title: Fork Sync
auto_approve: false
request failed after 4 retries with a delay of 60
Error: Failed to create or merge pull request: HttpError: Unprocessable Entity: "Can not approve your own pull request"
Do you know what could be the problem? If it is about a misconfiguration from my side, I will be happy to open a PR updating the documentation when I realize of my error.
Owner repo: https://github.com/mikecao/umami
My repo: https://github.com/tairosonloa/umami (you can see there some manually closed PR that the GitHub Action created while I was testing)
Although the action works, the following warning message appears on each run:
[sync](https://github.com/AlexRuiz7/wazuh-app/actions/runs/3472047825/jobs/5802348093)
Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: tgymnich/[email protected]
@dependabot has already opened several pull requests automatically to solve this, which are not merged yet.
Hi,
In my project, I would prefer that the conflicts always use my version, which means 'merge -Xours' would be really helpful.
Is there any way to implement this?
Is it okay to use version 1.1.6 of the action? As itβs apparently not published in the marketplace.
I would like to customize request retry parameters to reduce job run time.
request: {
retries: 4,
retryAfter: 60,
},
https://github.com/tgymnich/fork-sync/blob/master/src/main.ts#L10-L13
First off thanks much for this project, it's a big help! Occasionally PRs aren't getting automatically merged, when synchronizing a fork. This isn't too destructive since I can hit merge, but is a pain to go back and forth π .
[@octokit/rest] `const Octokit = require("@octokit/rest")` is deprecated. Use `const { Octokit } = require("@octokit/rest")` instead
(node:2543) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of undefined
at /home/runner/work/_actions/TG908/fork-sync/v1.1/lib/main.js:40:82
at Generator.throw (<anonymous>)
at rejected (/home/runner/work/_actions/TG908/fork-sync/v1.1/lib/main.js:6:65)
(node:2543) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)
(node:2543) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
These seem to be the logs, I'm guessing there's a ratelimit or something similar, but unclear how to debug further. Any ideas would be helpful!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.