{"id":17359941,"url":"https://github.com/tobked/github-forks-sync-action","last_synced_at":"2025-04-14T23:32:03.801Z","repository":{"id":42076357,"uuid":"273061067","full_name":"TobKed/github-forks-sync-action","owner":"TobKed","description":"GitHub Action to synchronise forks","archived":false,"fork":false,"pushed_at":"2022-10-19T08:58:21.000Z","size":21,"stargazers_count":33,"open_issues_count":0,"forks_count":22,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T06:47:55.583Z","etag":null,"topics":["github","github-action","github-actions"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TobKed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-17T19:26:44.000Z","updated_at":"2024-10-02T12:50:34.000Z","dependencies_parsed_at":"2023-01-04T12:24:54.007Z","dependency_job_id":null,"html_url":"https://github.com/TobKed/github-forks-sync-action","commit_stats":{"total_commits":26,"total_committers":5,"mean_commits":5.2,"dds":0.5384615384615384,"last_synced_commit":"2fb78daa46a630ff56455a63dec51ff00ba56e23"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TobKed%2Fgithub-forks-sync-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TobKed%2Fgithub-forks-sync-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TobKed%2Fgithub-forks-sync-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TobKed%2Fgithub-forks-sync-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TobKed","download_url":"https://codeload.github.com/TobKed/github-forks-sync-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248978965,"owners_count":21192882,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github","github-action","github-actions"],"created_at":"2024-10-15T19:13:36.963Z","updated_at":"2025-04-14T23:32:03.597Z","avatar_url":"https://github.com/TobKed.png","language":"Shell","readme":"# GitHub Action to synchronise forks\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Table of Contents**\n\n  - [Example Workflow file](#example-workflow-file)\n  - [Inputs](#inputs)\n  - [GitHub Token](#github-token)\n    - [Pull from public repository and push to current repository](#pull-from-public-repository-and-push-to-current-repository)\n    - [Pull from private repository and/or push to other repository](#pull-from-private-repository-andor-push-to-other-repository)\n  - [Example: Update multiple branches](#example-update-multiple-branches)\n- [License](#license)\n- [No affiliation with GitHub Inc.](#no-affiliation-with-github-inc)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n### Example Workflow file\n\n```yaml\njobs:\n  update_external_airflow_fork:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: TobKed/github-forks-sync-action@master\n        with:\n          github_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}\n          upstream_repository: apache/airflow\n          target_repository: TobKed/airflow\n          upstream_branch: master\n          target_branch: master\n          force: true\n          tags: true\n```\n\n### Inputs\n\n| name | value | default | description                                                                                                                                                                                                                                            |\n| ---- | ----- | ------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| github_token | string | | Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}`.                                                                                                                                                                              |\n| upstream_repository | string | | Repository name. If you want to pull from private repository, you should make a [personal access token](https://github.com/settings/tokens) and use it as the `github_token` input.                                                                    |\n| target_repository | string | | Repository name. Default or empty repository name represents current github repository. If you want to push to other repository, you should make a [personal access token](https://github.com/settings/tokens) and use it as the `github_token` input. |\n| upstream_branch | string | 'master' | Source branch from which changes will be pushed.                                                                                                                                                                                                       |\n| target_branch | string | 'master' | Destination branch to push changes.                                                                                                                                                                                                                    |\n| force | boolean | false | Determines if force push is used.                                                                                                                                                                                                                      |\n| tags | boolean | false | Determines if `--follow-tags --tags` is used.                                                                                                                                                                                                          |\n\n### GitHub Token\n\nGitHub Token is required to authenticate operations on the repository/repositories.\nIt should be stored as a secret.\nTo learn more about creating and using secrets check the [official docs](https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets).\n\n#### Pull from public repository and push to current repository\n\nGitHub automatically creates a `GITHUB_TOKEN` secret to use in your workflow.\nYou can use the `GITHUB_TOKEN` to authenticate in a workflow run.\n`github_token` input can be passed in as `${{ secrets.GITHUB_TOKEN }}`.\nTo learn more about this secret check the [official docs](https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token).\n\n#### Pull from private repository and/or push to other repository\n\nCreate Personal Access Token (PAT) with repo permissions and store it as a secret.\nThen it can be passed as in the example below:\n\n```yaml\ngithub_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}\n```\n\nTo learn more about this creating PAT check the [official docs](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token).\n\n### Example: Update multiple branches\n\nTo update multiple branches you can use matrix to parametrize it ([Create a build matrix and define variations for each job - GitHub Docs](https://docs.github.com/en/actions/using-jobs/using-a-build-matrix-for-your-jobs)).\n\n```yaml\nname: Sync all branches\non:\n  workflow_dispatch:\n\njobs:\n\n  generate-matrix:\n    name: Generate matrix of branches\n    runs-on: ubuntu-latest\n    outputs:\n      matrix: ${{ steps.set-matrix.outputs.matrix }}\n    steps:\n      - name: Set matrix of branches\n        id: set-matrix\n        run: |\n          upstream_repo=\"https://${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@github.com/${INPUT_UPSTREAM_REPOSITORY}.git\"\n\n          # these jq scripts will produce the same matrix jobs by default\n          # choose the one that works for any additional values that you may need to build your matrix with\n          jq_script='{ \"branch\": [inputs | split(\"\\n\") | .[] | gsub(\".*refs/heads/\"; \"\")] }'   # {\"branch\":[\"$branch_name_1\",\"$branch_name_2\"]}\n          # jq_script='[inputs | split(\"\\n\") | .[] | gsub(\".*refs/heads/\"; \"\") | { \"branch\": . }]' # [{\"branch\":\"$branch_name_1\"},{\"branch\":\"$branch_name_2\"}]\n\n          JSON=\"$(git ls-remote --heads \"$upstream_repo\" | jq -McnR \"$jq_script\")\"\n\n          # debug matrix pretty json formatted output\n          jq --monochrome-output . -- \u003c\u003c\u003c \"$JSON\"\n\n          # set output variable named 'matrix' for use in subsequent jobs that 'needs' this job.\n          # https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs\n          echo \"::set-output name=matrix::$JSON\"\n\n        env:\n          INPUT_GITHUB_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}\n          INPUT_UPSTREAM_REPOSITORY: apache/airflow\n\n  update_external_airflow_fork:\n    runs-on: ubuntu-latest\n    needs: generate-matrix\n    strategy:\n      matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}}\n      fail-fast: false\n    steps:\n      - uses: TobKed/github-forks-sync-action@master\n        with:\n          github_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}\n          upstream_repository: apache/airflow\n          target_repository: TobKed/airflow\n          upstream_branch: ${{ matrix.branch }}\n          target_branch: ${{ matrix.branch }}\n          force: true\n          tags: true\n```\n\n## License\n\nThe Dockerfile and associated scripts and documentation in this project are released under the [MIT License](LICENSE).\n\n## No affiliation with GitHub Inc.\n\nGitHub are registered trademarks of GitHub, Inc. GitHub name used in this project are for identification purposes only. The project is not associated in any way with GitHub Inc. and is not an official solution of GitHub Inc. It was made available in order to facilitate the use of the site GitHub.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobked%2Fgithub-forks-sync-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobked%2Fgithub-forks-sync-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobked%2Fgithub-forks-sync-action/lists"}