如何在 GitHub 操作 YML 文件中添加注释?

ove*_*nge 5 github github-actions

在下面的语法中:

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 Code Online (Sandbox Code Playgroud)

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

KEI*_*NOS 11

TL; 博士

  • 使用: #
- 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/"
Run Code Online (Sandbox Code Playgroud)

ts;博士

我一直在搜索官方 GitHub 文档并进行谷歌搜索,但找不到任何工作示例。

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

- 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/"
Run Code Online (Sandbox Code Playgroud)


Wha*_*own 0

在“运行 git 客户端来解决某些问题”之前添加一个主题标签,它就会变成一条评论。

(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 Code Online (Sandbox Code Playgroud)

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

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")
Run Code Online (Sandbox Code Playgroud)

(CSharp)

// I have a bad memory and actually can't find any code in my memory to put below
Run Code Online (Sandbox Code Playgroud)

如果您不确定我在说什么,只需将其复制并粘贴到您的 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 Code Online (Sandbox Code Playgroud)