我有以下 GitHub 作業流代碼:
- name: Check if the project is central
id: projectcheck
run: echo "::set-output name=central::${{ contains(github.event.inputs.project, 'central') }}"
- name: output
run: echo ${{ steps.projectcheck.outputs.central }}
--- here I am getting true/false correctly based on the input project but the below if conditions are not working
- name: if central
if: ${{ steps.projectcheck.outputs.central }} == "true"
run: echo "central"
- name: if not central
if: ${{ steps.projectcheck.outputs.central }} == "false"
run: echo "central"
如何使 if 運算式起作用?
uj5u.com熱心網友回復:
嘗試測驗
if: steps.projectcheck.outputs.central == 'true'
ìfsteps.projectcheck.outputs.central是一個字串文字,你不應該需要${{ }}
uj5u.com熱心網友回復:
我建議查看GitHub 操作中的運算式
if條件被視為運算式,因此不需要顯式${{ <expression> }},您可以像提到的VonC那樣撰寫它。
但是在任何地方都使用運算式是一個很好的經驗法則,我建議這樣寫:
if: ${{ steps.projectcheck.outputs.central == "true" }}
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/479111.html
上一篇:如何使用googlecolab運行匯入自定義python模塊(兩個檔案在存盤庫檔案夾中的級別相同)的現有jupyter筆記本?
