Code Monkey home page Code Monkey logo

action-release-label's Introduction

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.

action-release-label's People

Contributors

micnncim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

action-release-label's Issues

Use empty string as label-prefix input

What happened

Trying to use the action with no prefix. I want to use the simple labels of patch, minor, and major instead of prefixing them with release/ on my PR's.

The action ran without issue but output no level after putting an empty string for label_prefix instead of using the release/ default prefix. The debug logs showed no release label after running.

What you expected to happen

the action to output a level associated with one of the follow PR tags: patch, minor, and major as inputs

How to reproduce it

name: Test Repro

on:
  pull_request:
    types:
      - closed
    branches: 
      - 'main'

jobs:
  build:
    if: github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    steps:
      - uses: actions-ecosystem/action-get-merged-pull-request@v1
        id: get-merged-pull-request
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}

      - uses: actions-ecosystem/action-release-label@v1
        id: release-label
        if: ${{ steps.get-merged-pull-request.outputs.title != null }}
        with:
          label_prefix: ""
          labels: ${{ steps.get-merged-pull-request.outputs.labels }}

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

The last step will be skipped since steps.release-label.outputs.level == null

Environment

Not sure what is meant here. As in like what environment in GitHub Actions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.