Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Way to fetch value of github secret

Is there any way to fetch github secret value and display in workflow or fetch through library or APi or even github portal once it is stored. I just want to validate.

like image 270
Divanshu Aggarwal Avatar asked Oct 25 '25 01:10

Divanshu Aggarwal


2 Answers

Github Actions replaces secret values in the log, so if you want to view the secret you must change its value first. Like this step:

- name: DISPLAY SECRETS
  run: echo ${{secrets.mysecret}} | sed 's/./& /g'

This will insert a space between each character of the secret, allowing you to see its value.

like image 139
Jared Avatar answered Oct 28 '25 02:10

Jared


There is no way to actually display the github secret value but there are ways to validate eg you can use if: {{secret_name}} == 'release' , then do this else do that. Reference for writing if condition in github workflow: https://github.blog/changelog/2019-10-01-github-actions-new-workflow-syntax-features/

like image 33
Divanshu Aggarwal Avatar answered Oct 28 '25 03:10

Divanshu Aggarwal