{"id":18686720,"url":"https://github.com/wayfair-incubator/forker","last_synced_at":"2025-04-12T05:07:28.017Z","repository":{"id":37396265,"uuid":"367435554","full_name":"wayfair-incubator/forker","owner":"wayfair-incubator","description":"⑂ GitHub action for automating fork creation","archived":false,"fork":false,"pushed_at":"2024-04-01T22:50:55.000Z","size":2358,"stargazers_count":8,"open_issues_count":2,"forks_count":14,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T00:35:57.597Z","etag":null,"topics":["forking","github","github-actions","hacktoberfest","open-source-management","ospo"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/github-forker","language":"TypeScript","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/wayfair-incubator.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-14T17:29:46.000Z","updated_at":"2023-08-11T23:09:10.000Z","dependencies_parsed_at":"2023-09-30T01:03:05.600Z","dependency_job_id":"ac3fb208-f845-401d-ace2-6fd7b9b323f7","html_url":"https://github.com/wayfair-incubator/forker","commit_stats":{"total_commits":435,"total_committers":6,"mean_commits":72.5,"dds":0.2183908045977011,"last_synced_commit":"877208aa8676083698aab2bd684a67d272736fa2"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":"actions/typescript-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayfair-incubator%2Fforker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayfair-incubator%2Fforker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayfair-incubator%2Fforker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayfair-incubator%2Fforker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wayfair-incubator","download_url":"https://codeload.github.com/wayfair-incubator/forker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248519542,"owners_count":21117761,"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":["forking","github","github-actions","hacktoberfest","open-source-management","ospo"],"created_at":"2024-11-07T10:28:46.221Z","updated_at":"2025-04-12T05:07:27.981Z","avatar_url":"https://github.com/wayfair-incubator.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ⑂ forker\n\n[![Release](https://img.shields.io/github/v/release/wayfair-incubator/forker?display_name=tag)](https://github.com/wayfair-incubator/forker/releases)\n[![License: MIT](https://img.shields.io/badge/license-MIT-7F187F.svg)](LICENSE)\n[![Code of Conduct](https://img.shields.io/badge/CoC-2.0-24B8EE.svg)](CODE_OF_CONDUCT.md)\n[![Build](https://github.com/wayfair-incubator/forker/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/wayfair-incubator/forker/actions/workflows/build.yml)\n\n[GitHub Action](https://github.com/features/actions) to automate fork creation. This action uses [octokit.js](https://github.com/octokit/octokit.js) and the [GitHub API](https://docs.github.com/en/rest) to automatically create a repository fork, either in your personal GitHub account or a GitHub organization that you administer.\n\nIf the `checkUser` option is enabled, `forker` will check the specified GitHub organization membership status for the user requesting the fork. If the user is already an organization member, `forker` will proceed to fork the repo, and then optionally grant the user `admin` permissions when using in combination with the `promoteUser` option. If the user is **not** an organization member, `forker` will exit without forking the repository, and display an error.\n\nFor legal and compliance reasons, organizations or individuals can choose to provide an optional `licenseAllowlist` to compare against the [license of the repository](https://docs.github.com/en/rest/reference/licenses) being forked. If the license key returned by the GitHub API is not found within the provided allowlist, `forker` will exit without forking the repository, and display an error.\n\n---\n\n## Inputs\n\n### `token` (string, required)\n\nThe GitHub API [token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) you wish to use for automating fork creation. If you are using GitHub [encrypted secrets](https://docs.github.com/en/actions/reference/encrypted-secrets#using-encrypted-secrets-in-a-workflow), you should reference the variable name you have defined for your secret.\n\n\u003e 💡 **Tip:** Ensure the token you are using has sufficient permissions to fork repositories into your intended destination (either an organization or individual user account). In particular, the builtin `GITHUB_TOKEN` has [read-only permissions](https://docs.github.com/en/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token) for repository forks, and therefore may not provide sufficient privileges for use with `forker`.\n\n**Example:** `${{ secrets.ACCESS_TOKEN }}`\n\n### `owner` (string, required)\n\nThe owner of the GitHub repository you wish to fork. Can be an organization or individual user account.\n\n**Example:** `tremor-rs`\n\n### `repo` (string, required)\n\nThe name of the GitHub repository you wish to fork.\n\n**Example:** `tremor-runtime`\n\n### `org` (string, optional)\n\nThe name of the destination GitHub organization where you wish to fork the specified repository.\n\n**Example:** `wayfair-contribs`\n\n### `user` (string, optional)\n\nThe GitHub account for the person requesting the fork.\n\n\u003e 💡 **Tip:** This is only required if you are managing a GitHub organization, and wish to associate a specific user with the fork request. If neither `org` nor `user` inputs are specified, `forker` will default to forking the repository into your own GitHub account. Similarly, if _only_ `user` is provided without an accompanying `org`, forker will ignore the field, since users cannot create forks on behalf of other users, only GitHub organizations.\n\n**Example:** `lelia`\n\n### `checkUser` (boolean, optional)\n\nEnforces existing membership for a specified `user` in a specified GitHub `org`.\n\n\u003e 💡 **Tip:** If the user **is** already a GitHub `org` member, `forker` will proceed to fork the `repo`. You can optionally combine this with the `promoteUser` option to grant the user `admin` [permissions](https://docs.github.com/en/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization) on the forked `repo`.\n\u003e\n\u003e 🚨 **Warning:** If the user is **not** a GitHub `org` member, `forker` will exit without forking the repository.\n\n**Example:** `true`\n\n**Default:** `false`\n\n### `promoteUser` (boolean, optional)\n\nGrants GitHub `org` members `admin` [permissions](https://docs.github.com/en/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization) on the `repo` they wish to fork.\n\n\u003e 💡 **Tip:** If the requesting user only intends to make upstream contributions to the `repo` they wish to fork, it is **very likely** that they will not require elevated `admin` privileges. That said, if there is an eventual desire to truly _fork_ off and deviate substantially from the originating project, this option helps give users better control over their project and maintainership.\n\u003e\n\u003e 🚨 **Warning:** If the `promoteUser` option is **not** used in combination with `checkUser`, GitHub users who are not currently GitHub org members may still receive elevated permissions for a repository fork within your organization. If this is an unacceptable degree of risk, you may wish to strictly enforce GitHub org membership by additionally setting `checkUser` to `true`.\n\n**Example:** `true`\n\n**Default:** `false`\n\n### `licenseAllowlist` (optional, string)\n\nA newline-delimited (`\"\\n\"`) string representing a list of allowed [license keys](https://docs.github.com/en/rest/reference/licenses) for the repository being forked. If the license key returned by the [Licenses API](https://docs.github.com/en/rest/reference/licenses) is not found within the `licenseAllowlist`, `forker` will **not** fork the repository, and instead exit with a warning.\n\n\u003e 💡 **Tip:** You can always reference [this directory](https://github.com/github/choosealicense.com/tree/gh-pages/_licenses) if you need a comprehensive list of license keys, beyond the commonly-used licenses returned from `GET /licenses` in the [GitHub REST API](https://docs.github.com/en/rest/reference/licenses#get-all-commonly-used-licenses).\n\n**Example:** `\"0bsd\\napache-2.0\\nmit\"`\n\n### `targetInstanceUrl` (optional, string)\n\nThis parameter can be used to target a GitHub Enterprise Server instance instead of \u003chttps://github.com\u003e.\n\n**Example:** `https://my-private.github-server.com`\n\n## Outputs\n\n### `forkUrl` (string)\n\nA string representing the HTTPS URL of the newly-forked repository.\n\n**Example:** `\"https://github.com/wayfair-contribs/tremor-runtime\"`\n\n---\n\n## Usage\n\n### Typical\n\nIn most cases, you'll want to use the latest stable version (eg. `v0.0.6`):\n\n```yaml\nuses: wayfair-incubator/forker@v0.0.6\nwith:\n  token: ${{ secrets.ACCESS_TOKEN }}\n  repo: tremor-runtime\n  owner: tremor-rs\n  user: lelia\n```\n\n### Development\n\nIf you're actively developing a new feature for the action, you can always reference a specific commit SHA (eg. `a694606ff02c8ba2654865adeb7a6d2053b34afa`):\n\n```yaml\nuses: wayfair-incubator/forker@a694606ff02c8ba2654865adeb7a6d2053b34afa\nwith:\n  token: ${{ secrets.ACCESS_TOKEN }}\n  repo: tremor-runtime\n  owner: tremor-rs\n  user: lelia\n```\n\n### Advanced\n\nIf you are automating the creation of forks on behalf of a GitHub organization with many users, you may wish to leverage the optional `checkUser`, `promoteUser`, and `licenseAllowlist` params:\n\n```yaml\nuses: wayfair-incubator/forker@v0.0.6\nwith:\n  token: ${{ secrets.ACCESS_TOKEN }}\n  repo: tremor-runtime\n  owner: tremor-rs\n  org: wayfair-contribs\n  user: lelia\n  checkUser: true\n  promoteUser: true\n  licenseAllowlist: \"0bsd\\napache-2.0\\nmit\"\n```\n\n### Target a GitHub Enterprise Server\n\nCreate a fork in your own GitHub Enterprise Server:\n\n```yaml\nuses: wayfair-incubator/forker@a694606ff02c8ba2654865adeb7a6d2053b34afa\nwith:\n  token: ${{ secrets.ACCESS_TOKEN }}\n  repo: tremor-runtime\n  owner: tremor-rs\n  user: lelia\n  targetInstanceUrl: https://my-private.github-server.com\n```\n\n---\n\n## Developing\n\n\u003e 💡 **Tip:** Please use [node.js](https://nodejs.org/en/download/releases/) v17.x or later, as well as [TypeScript](https://www.npmjs.com/package/typescript) v4.x or later.\n\nInstall the node.js dependencies:\n\n```bash\nnpm install\n```\n\nBuild the TypeScript code and package it for distribution:\n\n```bash\nnpm run build \u0026\u0026 npm run package\n```\n\nRun the Jest unit tests:\n\n\u003e 💡 **Tip:** Before running any tests locally which require authenticating against the GitHub API, please ensure you've defined a valid token for the environment variable `INPUT_TOKEN` in your preferred shell (or shell profile), eg: `export INPUT_TOKEN=\"my_github_api_token_value\"`. This is functionally equivalent to defining an input value for the `token` parameter in your GitHub Action's [workflow YAML](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions) configuration.\n\n```bash\n$ npm test\n\n PASS  __tests__/main.test.ts\n  ✓ forker action runs with env inputs (631 ms)\n```\n\nConvenience command to run all npm scripts:\n\n```bash\nnpm run all\n```\n\n### Publishing\n\nActions are run from GitHub repos so we will checkin the packed `dist/` folder.\n\nThen run [ncc](https://github.com/zeit/ncc) and push the results:\n\n```bash\nnpm run package\ngit add dist\ngit commit -a -m \"prod dependencies\"\ngit push origin releases/v0.0.6\n```\n\n\u003e 💡 **Tip:** We recommend using the `--license` option for `ncc`, which will create a license file for all of the production node modules used in your project.\n\nYour action is now published! 🚀\n\nSee the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) for more details.\n\n### Validation\n\nYou can now validate the action by referencing `./` in a workflow in your repo (see [`build.yml`](.github/workflows/build.yml))\n\n```yaml\nuses: ./\nwith:\n  path: ./\n  token: ${{ secrets.ACCESS_TOKEN }}\n  ref: ${{ github.event.pull_request.head.sha }}\n  repo: tremor-runtime\n  owner: tremor-rs\n  user: lelia\n```\n\nSee the [Actions tab](https://github.com/wayfair-incubator/forker/actions) to view runs of this action!  ✅\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. For detailed contributing guidelines, please see [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## License\n\nDistributed under the MIT License. See [LICENSE](LICENSE) for more information.\n\n## Acknowledgements\n\nThis [GitHub Action](https://github.com/features/actions) was adapted from the [typescript-action](https://github.com/actions/typescript-action) template, with additional [project content](https://github.com/wayfair-incubator/oss-template) curated with 💜 by [Wayfair](https://github.com/wayfair).\n\nFor more information about Wayfair's [Open Source Program Office](https://www.linuxfoundation.org/tools/creating-an-open-source-program/), check out [**wayfair.github.io**](https://wayfair.github.io/) 🎉\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwayfair-incubator%2Fforker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwayfair-incubator%2Fforker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwayfair-incubator%2Fforker/lists"}