大佬教程收集整理的这篇文章主要介绍了用于读取 JSON 文件的 GitHub 操作,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想编写一个使用 JsON 数据作为参数的 GH 操作。
计划是在一个步骤中将 terraform 输出保存为 JsON 文件,并在顺序步骤中访问它。
name: Test and terraform
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
Unit-Tests:
...
terraform:
runs-on: ubuntu-18.04
needs: [ Unit-Tests,S3-Sync ]
steps:
...
- name: terraform Apply
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
cd terraform
terraform apply -auto-approve
terraform output --Json > output.Json
- name: Set terraform Output
ID: output
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
content=`cat ./terraform/output.Json`
# the following lines are only required for multi line Json
content="${Content//'%'/'%25'}"
content="${Content//$'\n'/'%0A'}"
content="${Content//$'\r'/'%0D'}"
# end of optional handling for multi line Json
echo "::set-output name=terraform::$content"
- name: Gatsby Cloud Sync
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
echo "${{fromJson(steps.output.outputs.terraform)}}"
我遇到的当前错误是最后一步的格式不正确。
模板无效。 .github/workflows/main.yml(第 154 行,第 14 列):解析值时遇到意外字符:c。路径 '',第 1 行,位置 1。
最后一步 Gatsby Cloud Sync
的格式如何不正确?
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的用于读取 JSON 文件的 GitHub 操作全部内容,希望文章能够帮你解决用于读取 JSON 文件的 GitHub 操作所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。