actions-ecosystem / action-release-label

🏷️ GitHub Action to output a semver update level from a pull request release label

Home Page:https://github.com/marketplace/actions/actions-ecosystem-action-release-label

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Action Release Label

actions-workflow-lint release license

screenshot

This is a GitHub Action to output a semver update level major, minor, patch from a pull request release label.

For example, if a pull request has the label release/minor, this action outputs minor as level.

It would be more useful to use this with other GitHub Actions' outputs. It's recommended to use this with actions-ecosystem/action-bump-semver and actions-ecosystem/action-push-tag.

This action supports pull_request and push events.

Prerequisites

It's necessary to create labels with the inputs.label_prefix prefix and the major, minor, patch suffix before getting started with this action.

By default, they're release/major, release/minor, and release/patch.

Inputs

NAME DESCRIPTION TYPE REQUIRED DEFAULT
label_prefix A prefix for labels that indicate semver level {major, minor, patch}. string false release/
labels The list of labels for the pull request. Separated with line breaks if there're multiple labels. Required for push events, not for pull_request events. string false N/A

It would be easy to prepare inputs.labels with actions-ecosystem/action-get-merged-pull-request.

Outputs

NAME DESCRIPTION TYPE
level A semver update level {major, minor, patch}. string

Example

Simple

name: Push a new tag with Pull Request

on:
  pull_request:
    types: [closed]

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - uses: actions-ecosystem/action-release-label@v1
        id: release-label
        if: ${{ github.event.pull_request.merged == true }}

      - uses: actions-ecosystem/action-get-latest-tag@v1
        id: get-latest-tag
        if: ${{ steps.release-label.outputs.level != null }}

      - uses: actions-ecosystem/action-bump-semver@v1
        id: bump-semver
        if: ${{ steps.release-label.outputs.level != null }}
        with:
          current_version: ${{ steps.get-latest-tag.outputs.tag }}
          level: ${{ steps.release-label.outputs.level }}

      - uses: actions-ecosystem/action-push-tag@v1
        if: ${{ steps.release-label.outputs.level != null }}
        with:
          tag: ${{ steps.bump-semver.outputs.new_version }}
          message: '${{ steps.bump-semver.outputs.new_version }}: PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}'

Note

This action is inspired by haya14busa/action-bumpr.

License

Copyright 2020 The Actions Ecosystem Authors.

Action Release Label is released under the Apache License 2.0.

About

🏷️ GitHub Action to output a semver update level from a pull request release label

https://github.com/marketplace/actions/actions-ecosystem-action-release-label

License:Apache License 2.0


Languages

Language:Shell 89.5%Language:Dockerfile 10.5%