我如何在GitHub动作YML文件中添加评论?



在以下语法中:

jobs:
testing:
name: some test
runs-on: [ self-hosted, linux, xyz ]
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15.0
id: go
- name: Configure git client
run: git config --global url."ssh://git@github.com:".insteadOf "https://github.com/"

如何添加run git client to fix some issue作为运行命令的注释?

博士
  • 使用: #
- run: git config --global url."ssh://git@github.com:".insteadOf "https://github.com/" # run git client to fix some issue
+ run: |
+   : # run git client to fix some issue
+   git config --global url."ssh://git@github.com:".insteadOf "https://github.com/"

ts;

博士我一直在搜索官方GitHub文档和谷歌周围,但找不到任何工作样本。

我通过使用:操作数得出了答案,该操作数只返回true,后跟注释#,如下所示:

jobs:
testing:
name: some test
runs-on: [ self-hosted, linux, xyz ]
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15.0
id: go
- name: Configure git client
run: |
: # run git client to fix some issue
git config --global url."ssh://git@github.com:".insteadOf "https://github.com/"

在"运行git client修复某些问题"之前添加标签;然后变成注释

(YML)

jobs:
testing:
name: some test
runs-on: [ self-hosted, linux, xyz ]
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15.0
id: go
- name: Configure git client
run: git config --global url."ssh://git@github.com:".insteadOf "https://github.com/" # run git client to fix some issue

如果您不确定编码语言使用什么注释前缀,请尝试#或//

Python使用#前缀表示注释,CSharp使用//前缀表示注释。

(Python)

# please use my def (actually I thought I made an error in this code but I guess not)
def someDef(string):
print(string)
someDef("Hi")

(CSharp)
// I have a bad memory and actually can't find any code in my memory to put below

如果你不知道我在说什么,只需复制并粘贴到你的YML文件:

jobs:
testing:
name: some test
runs-on: [ self-hosted, linux, xyz ]
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15.0
id: go
- name: Configure git client
run: git config --global url."ssh://git@github.com:".insteadOf "https://github.com/" # run git client to fix some issue

最新更新