英文:
Import a JS function inside of YAML file
问题
github-workflow.yaml
variables:
message: computeTheString()
name: My Trigger
on:
pull_request_target:
types: [labeled]
jobs:
publish:
runs-on: [default]
steps:
- name: Step name here
run: echo ${{ variables.message }}
computeTheString.js
export function computeTheString() {
return JSON.stringify(slightlyLongerString);
}
英文:
I'm trying to pass custom variable inside of yaml file which will be computed in a separate file.
Is there a way I can do that?
github-workflow.yaml
variable:
message: computeTheString()
name: My Trigger
on:
pull_request_target:
types: [labeled]
jobs:
publish:
runs-on: [ default ]
steps:
- name: Step name here
run: echo ${{ variable. message }}
computeTheString.js
export function computeTheString() {
return JSON.stringify(slightlyLongerString)
}
答案1
得分: 1
你可以尝试使用管道符号(|),它表示多行输入。这里是一个使用内联函数的CloudFormation示例:
variables:
message: |
export function computeTheString() {
return JSON.stringify(slightlyLongerString);
}
英文:
You could try to use the pipe symbol (|) which indicates a multi-line entry. here's an example of CloudFormation with inline function:
variable:
message: |
export function computeTheString() {
return JSON.stringify(slightlyLongerString)
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论