GithubHelp home page GithubHelp logo

slugify-action's Introduction

Slugify Github Action

This action slugifies the commit ref (branch or tag name) similar to what Gitlab uses. It also sets a shortened commit SHA.

Slugify will get the branch name for push and pull_request events and then process it as follows:

  • Lowercased
  • Anything not matching [a-z0-9-] is replaced with a -
  • Maximum length is 63 bytes
  • First/Last Character is not a hyphen

inputs

sha_length:

  • description: 'The length to shorten the commit SHA to'
  • required: false
  • default: '7'

outputs:

branch:

  • description: 'The slugified branch'

sha:

  • description: 'The <sha_length> character SHA of the commit'

Usage

Define a workflow in .github/workflows/continuous-integration.yml (or add a job if you already have defined workflows).

๐Ÿ’ก Read more about Configuring a workflow.

on:
  pull_request:
  push:
    branches:
      - main
    tags:
      - "**"

name: "Continuous Integration"

jobs:
  github-action-template:
    name: github-action-template

    runs-on: ubuntu-latest

    steps:
      - name: "Checkout"
        uses: actions/checkout@v3

      - name: "Run slugify"
        id: slugify
        uses: eltimn/slugify-action@v2

      - name: "Echo slugify outputs"
        run: |
          echo ${{steps.slugify.outputs.branch}}-${{steps.slugify.outputs.sha}}

License

This package is licensed using the MIT

Publishing

Run npm run package to create a distribution artifact.

slugify-action's People

Contributors

eltimn avatar dependabot[bot] avatar

Watchers

 avatar James Cloos avatar

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.