获取并输出Github Action 的变量,secrets

Echo Github Action Environment variables

方式一:



      - name: Dump DEV_DB_NAME
        run: echo -n "${
   
   { secrets.DEV_DB_NAME }}" | xxd -ps
      - name: Dump DEV_DB_NAME
        run: echo -n "${
   
   { secrets.DEV_DB_NAME }}" >> foo && cut -c1-1 foo && cut -c 2- foo

        

方式二:

name: Secret Printer

on:
  schedule:
  - cron: '30 04 * * *'
    
  workflow_dispatch:

jobs:
  print_secret:
    runs-on: ubuntu-latest

    steps:
    - name: python print secret
      env:
        MY_VAL: ${
   
   { secrets.SUPER_SECRET }}
      run: |
        import os
        for q in (os.getenv("MY_VAL")):
          print(q)
      shell: python



Contexts - GitHub Docs

猜你喜欢

转载自blog.csdn.net/qq_36279445/article/details/131850490