0

我正在尝试使用GitHub CLI自动化GitHub的拉取请求创建过程。

我目前正在使用以下脚本,它就像一个魅力:

(
  # Parentheses are used here to avoid the exposure of temporal variables to the outer scope.
  # Tested on macOS bash only.
  
  cd ~/Projects/pet_projects/basic_temperature
   
  # Pushes the release branch to the remote repository.
  git push origin release_nemo

  # Logs in to GitHub CLI using pre-generated access token.
  # https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
  gh auth login --with-token < ~/Projects/pet_projects/.github_cli_access_token
   
# Sets HEREDOC to PR_TITLE variable.
# Indentation is avoided here intentionally.
# https://stackoverflow.com/a/1655389/12201472
read -r -d '' PR_TITLE <<-'TEXT'
This is a Placeholder PR to check whether all specs are green [Current Release][Nemo]
TEXT
 
# Sets HEREDOC to PR_BODY variable.
# Indentation is avoided here intentionally.
# https://stackoverflow.com/a/1655389/12201472
read -r -d '' PR_BODY <<-'MARKDOWN'
[RELEASE CARD TODO]() (**❗This PR is NOT completed yet!❗**)
      
### Already included cards:
- None.
 
### Cards to be included:
- None.
 
### Previous Release TODO
MARKDOWN
 
  gh pr create \
    --title "${PR_TITLE}" \
    --body "${PR_BODY}" \
    --base master \
    --head release_nemo \
    --assignee @me \
    --label Release \
    --web
)

我现在唯一的问题,我不清楚如何更新这个命令

gh pr create \
  --title "${PR_TITLE}" \
  --body "${PR_BODY}" \
  --base master \
  --head release_nemo \
  --assignee @me \
  --label Release \
  --web

将多个受让人分配给新创建的 PR?

我已经仔细阅读了gh pr create文档,但我还没有找到实现它的方法。

提前感谢您的帮助。

4

1 回答 1

2

gh 命令github.com/spf13/cobra用于命令行标志解析,Assignees字段为StringSlice. 根据cobra docs,您可以多次提供标志或用逗号分隔多个值。

所以你可以做--assignee @me --assignee @you--assignee @me,@you

于 2021-04-15T00:45:23.087 回答