1
0
mirror of https://github.com/benjlevesque/short-sha.git synced 2025-12-06 01:37:51 +01:00
2023-03-19 11:36:59 +01:00
2022-10-28 15:22:54 +02:00
2020-03-09 19:02:59 +01:00
2020-03-09 19:02:59 +01:00
2020-03-09 19:02:59 +01:00
2020-03-09 22:00:34 +01:00
2020-03-09 19:02:59 +01:00
2020-03-09 19:02:59 +01:00
2022-10-28 15:32:05 +02:00
2022-10-28 15:04:23 +02:00
2022-10-28 15:32:05 +02:00

Short SHA

short-sha is a GitHub Action than provides an output sha with the shortened commit SHA.

Usage

You can access the shortened value with either ${{ steps.short-sha.outputs.sha }} (short-sha being the name of the action step) or ${{ env.SHA }}.

name: 'build-test'
on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: benjlevesque/short-sha@v2.2
        id: short-sha
        with:
          length: 6
      - run: echo $SHA
        env:
          SHA: ${{ steps.short-sha.outputs.sha }}
      - run: echo $SHA
        env:
          SHA: ${{ env.SHA }}

Options

Name Required Default Description
length false 7 the expected length of the shortened SHA
variable_name false SHA the name of the exported env variable
Description
Github Action to shorten the git SHA1 and make it accessible in outputs
Readme MIT 821 KiB
Languages
TypeScript 88.9%
JavaScript 11.1%