gpt4 book ai didi

github - 如何使用github Action 在commit上创建注释?

转载 作者:行者123 更新时间:2023-12-03 16:53:24 25 4
gpt4 key购买 nike

我在此配置中使用github操作

name: Node CI

on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: install node
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: npm install
run: npm install
- name: npm build
run: npm run build --if-present
- name: npm test
run: npm test
- name: make storybook
run: npm run build-storybook
- uses: dswistowski/surge-sh-action@v1
with:
domain: 'https://react-strix-$(git rev-parse --short HEAD).surge.sh'
project: '.out'
login: straxico@gmail.com
token: ${{ secrets.SURGE_PASSWORD }}
- name: deploy image
run: |
docker login docker.pkg.github.com --username straxico --password ${{ secrets.DOCKER_PASSWORD }}
docker build . --file Dockerfile --tag docker.pkg.github.com/straxico/react-strix/master:$(git describe --tags)
docker push docker.pkg.github.com/straxico/react-strix/master:$(git describe --tags)

我想自动为最新推送的提交创建评论,其中消息包括我的故事书和Docker URL。就像“现在”的机器人

enter image description here

如何使用github操作对提交写评论?

最佳答案

更新:我编写了一个简化创建提交注释的操作。我将在下面保留原始解决方案以供引用。

有关完整的用法详细信息,请参见commit-comment

      - name: Create commit comment
uses: peter-evans/commit-comment@v1
with:
body: |
This is a multi-line test comment
- With GitHub **Markdown**
- Created by [commit-comment][1]

[1]: https://github.com/peter-evans/commit-comment

commit-comment action example

原始解决方案:以下工作流程应该是一个很好的起点。您可以在此处找到该API的完整文档:
https://developer.github.com/v3/repos/comments/#create-a-commit-comment
name: commit comment
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Add commit comment
run: |
jq -nc '{"body": "test comment"}' | \
curl -sL -X POST -d @- \
-H "Content-Type: application/json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/comments"

它将像这样在提交上创建注释。
commit comment example

关于github - 如何使用github Action 在commit上创建注释?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58468495/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com