A GitHub Action to transfer an issue between repositories using labels. Supports transferring issues from private to public repositories.
The goal of this GitHub Action is to facilitate the transfer of issues between repositories of the same organization.
In short, attaching a label transfer:sandbox will transfer an issue from its
current repositories to the sandbox repository.
This issue makes it possible to overcome the two major limitations of GitHub UI when it comes to transferring issues between repositories:
- Maintaining issue labels during the transfer
- Transferring from private to public repositories
These operations are possible with this action.
Transferring issues from private to public repositories is not supported by GitHub by default (see related post here).
Nevertheless the community has found a way to go around that limitation, process that can be entirely automated.
When allow_private_public_transfer is enabled, and if a request is made to
transfer to an issue from a private repository to a public one, a temporary
private repository will be automatically created, the issue will be transferred
to that repository which will then be made public. The issue is then transferred
to its final destination and the temporary repository is deleted.
This manipulation requires your Personal API Token to have the delete_repo
scope.
The name of that temporary repository is composed of a stringified date to which a random 5 characters string is appended.
This option is disabled by default.
name: Transfer issue
on:
issues:
types:
- labeled
jobs:
transfer:
runs-on: ubuntu-latest
steps:
- name: Transfer issue
# Replace main by the release of your choice
uses: fgerthoffert/actions-transfer-issue@main
with:
token: YOUR_TOKEN
create_labels_if_missing: true
allow_private_public_transfer: trueThe following input parameters are available:
| Parameter | Default | Description | Required |
|---|---|---|---|
| token | A GitHub Personal API Token | true | |
| router_prefix | transfer: | Label prefix to identify where to transfer the issue (for example, "transfer:sandbox") | true |
| allow_private_public_transfer | false | Allow issues to be transferred from private to public repositories. | |
| allow_private_public_transfer_comment | false | Once the transfer from public to private is successful, add a comment to the issue with the repositories. Warning, this will publicly expose the name of the source repository | |
| create_labels_if_missing | true | Create labels in the destination repository if missing | |
| github_issue_id | When providing a GitHub Issue ID (GraphQL ID) the action will use that ID instead of the one provided in the event payload. | false |
The following outputs are available:
| Name | Description |
|---|---|
| issue_id | The ID of the migrated issue |
- Fork the repository
- npm install
- Rename .env.example into .env
- Update the INPUT_ variables
- Do your changes
- npx local-action . src/main.ts .env
- npm run bundle
- npm test
- PR into this repository, detailing your changes
More details about GitHub TypeScript action are available here
