Skip to content

tdsultratom/create-branch-from-tag

 
 

Repository files navigation

create-branch-from-tag

This action will create a new branch from a tag.

This GitHub Action (written in JavaScript) wraps the GitHub Branches API.

Usage

Pre-requisites

Create a workflow .yml file in your .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.

Inputs

  • tag_ref: The ref (name) of the tag for this release
  • owner: The name of the owner of the repo. Used to identify the owner of the repository. Used when cutting releases for external repositories. Default: Current owner
  • repo: The name of the repository. Used to identify the repository on which to release. Used when cutting releases for external repositories. Default: Current repository

Outputs

  • tag_name: The Tag Name
  • branch_name: The Branch Name
  • branch_url: The URL users can navigate to in order to view the branch.

Example workflow - create a release

On every push to a tag matching the pattern v*:

on:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
      - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create Branch

jobs:
  build:
    name: Create Branch
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Create Branch
        id: create_branch
        uses: tdsultratom/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
        with:
          tag_ref: ${{ github.ref }}
          owner: ${{ github.repository_owner }} # https://docs.github.com/en/actions/learn-github-actions/contexts#example-contents-of-the-github-context
          repo: ${{ github.event.repository.name }} # https://www.reddit.com/r/github/comments/tjkj6f/get_repo_name_on_github_actions_without_owner/

This will create a Branch, This uses the GITHUB_TOKEN provided by the virtual environment, so no new token is needed.

Contributing

See @lablnet/create-branch-from-tag

License

The scripts and documentation in this project are released under the MIT License

About

This action will create a new branch from a tag.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%