Initializes a git repository of contents in workspace and publishes it to GitHub.
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| token | string | The token to use for authorization to GitHub | |
| access | string | Sets an admin collaborator on the repository. Can either be a user reference different from `owner` in `repoUrl` or team reference, eg. `org/team-name` | |
| topics | array | Adds topics to the repository | |
| hasWiki | boolean | Enable the wiki for the repository. The default value is `true` | |
| repoUrl | string | Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the new repository name and `owner` is an organization or username | |
| secrets | object | Secrets attached to the repository | |
| homepage | string | Repository Homepage | |
| hasIssues | boolean | Enable issues for the repository. The default value is `true` | |
| subscribe | boolean | - | |
| sourcePath | string | Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository. | |
| description | string | Repository Description | |
| hasProjects | boolean | Enable projects for the repository. The default value is `true` unless the organization has disabled repository projects | |
| restrictions | object | - | |
| collaborators | array | Provide additional users or teams with permissions | |
| defaultBranch | string | - | |
| gitAuthorName | string | Sets the default author name for the commit. The default value is `Scaffolder` | |
| repoVariables | object | Variables attached to the repository | |
| allowAutoMerge | boolean | Allow individual PRs to merge automatically when all merge requirements are met. The default value is `false` | |
| gitAuthorEmail | string | - | |
| repoVisibility | string | - | |
| allowMergeCommit | boolean | Allow merge commits. The default value is `true` | |
| allowRebaseMerge | boolean | Allow rebase merges. The default value is `true` | |
| allowSquashMerge | boolean | Allow squash merges. The default value is `true` | |
| customProperties | object | Custom properties to be added to the repository (note, this only works for organization repositories). All values must be strings | |
| gitCommitMessage | string | Sets the commit message on the repository. The default value is `initial commit` | |
| allowUpdateBranch | boolean | Allow branch to be updated. The default value is `false` | |
| oidcCustomization | object | - | |
| deleteBranchOnMerge | boolean | Delete the branch after merging the PR. The default value is `false` | |
| dismissStaleReviews | boolean | New reviewable commits pushed to a matching branch will dismiss pull request review approvals. | |
| protectDefaultBranch | boolean | Protect the default branch after creating the repository. The default value is `true` | |
| protectEnforceAdmins | boolean | Enforce admins to adhere to default branch protection. The default value is `true` | |
| requiredCommitSigning | boolean | - | |
| requiredLinearHistory | boolean | - | |
| squashMergeCommitTitle | string | - | |
| requireCodeOwnerReviews | boolean | Require an approved review in PR including files with a designated Code Owner | |
| requireLastPushApproval | boolean | Whether the most recent push to a PR must be approved by someone other than the person who pushed it. The default value is `false` | |
| squashMergeCommitMessage | string | - | |
| bypassPullRequestAllowances | object | - | |
| requireBranchesToBeUpToDate | boolean | Require branches to be up to date before merging. The default value is `true` | |
| requiredStatusCheckContexts | array | The list of status checks to require in order to merge into this branch | |
| requiredApprovingReviewCount | number | Specify the number of reviewers required to approve pull requests. Use a number between `1` and `6` or `0` to not require reviewers. Defaults to `1`. | |
| requiredConversationResolution | boolean | Requires all conversations on code to be resolved before a pull request can be merged into this branch |
Output Schema
| Property | Type | Description | Required |
|---|---|---|---|
| remoteUrl | string | A URL to the repository with the provider | |
| commitHash | string | The git commit hash of the initial commit | |
| repoContentsUrl | string | A URL to the root of the repository |
Usage Examples
Publish a private repo to a GitHub organization with branch protection
Publishes the generated service to a private repository under an organization, sets the default branch, and enables basic branch protection. Use this after fetch:template and follow with catalog:register.
steps:
- id: fetch-base
action: fetch:template
input:
url: https://github.com/backstage/software-templates/tree/main/scaffolder-templates/service-skeleton
targetPath: .
values:
name: ${{ parameters.name }}
owner: ${{ parameters.owner }}
description: ${{ parameters.description }}
- id: publish
action: publish:github
input:
repoUrl: github.com?owner=acme-org&repo=${{ parameters.repoName }}
repoVisibility: private
description: Order processing service for Acme
defaultBranch: main
protectDefaultBranch: true
requireCodeOwnerReviews: true
requiredApprovingReviewCount: 1
topics:
- orders
- node
- backstage
- id: register
action: catalog:register
input:
catalogInfoUrl: ${{ steps.publish.output.repoContentsUrl }}/catalog-info.yamlPublish to GitHub Enterprise with internal visibility and a nondefault branch
Publishes to a GitHub Enterprise host with internal visibility and uses a develop default branch. Use this when your organization hosts GitHub on a custom domain and wants repos visible to the enterprise only.
steps:
- id: fetch-skeleton
action: fetch:template
input:
url: https://github.com/backstage/software-templates/tree/main/scaffolder-templates/library-skeleton
targetPath: .
values:
name: ${{ parameters.name }}
owner: ${{ parameters.owner }}
description: ${{ parameters.description }}
- id: publish
action: publish:github
input:
repoUrl: ghe.acme.internal?owner=platform-eng&repo=${{ parameters.repoName }}
repoVisibility: internal
description: Shared payments library for internal services
defaultBranch: develop
protectDefaultBranch: false
requireCodeOwnerReviews: false
topics:
- payments
- shared-lib
- typescript
- id: register
action: catalog:register
input:
catalogInfoUrl: ${{ steps.publish.output.repoContentsUrl }}/catalog-info.yaml