Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create random uuid in a github action

Howdo i create a random uuid from a github action? I found a third party github action that creates a random uuid but i am hoping there is some native action that already supports this scenario.

like image 600
Captain Jack sparrow Avatar asked Oct 20 '25 05:10

Captain Jack sparrow


2 Answers

With a Linux runner you can use uuidgen:

name: Test linux job
on:
  push

jobs:
  testJob:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - run: |
          uuidgen

This will output the uuid to the console. You can then redirect the output to a file or a variable with the standard shell mechanisms.

like image 153
riQQ Avatar answered Oct 22 '25 07:10

riQQ


as an improvement to the answer from @riQQ

name: Test linux job
on:
  push

jobs:
  testJob:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - name: Get uuid
        id: uuid
        run: | 
            echo "::set-output name=uuid::$(uuidgen)"
  
like image 35
gmetax Avatar answered Oct 22 '25 07:10

gmetax