This action ensures existence of a particular repo in GH. If it doesn't exist, it attempts to create it with the provided token.
- Requires organization to work. Doesn't currently support personal accounts.
The following example will create a repo within the same organization with the built suffix. Eg, if this runs on sample/repo
, a repo would be created under sample/repo-built
- name: Ensure Repo Exists
id: repo-check
uses: saucal/action-maybe-create-repo@v1
with:
token: "GH_PERSONAL_TOKEN" # need a token that can create repos in an organization
repo-suffix: "built"
- uses: saucal/action-maybe-create-repo@v1
with:
# Repo to use as a base
repo: "${{ github.repository }}"
# Token to use to create the repo.
# Defaults to autogenerated one but won't work due to permissions 🤪
token: "${{ github.token }}"
# Suffix to use on newly generated repo (appended to the current repo name)
repo-suffix: "built"
# Whether to exclude or not outside collaborators.
exclude-outside-collaborators: true
# Slug of the repo created
- ${{ steps.*.outputs.repo }}