i use github action with this config
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: [email protected]
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)
I want to automatically create a comment on the latest pushed commit wite msg include my storybook and docker URL. like "now" bot
How can write a comment on commit with github actions?
Update: I wrote an action to simplify creating commit comments. I will leave the original solution below for reference.
See commit-comment for full usage details.
- 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
Original Solution: The following workflow should be a good starting point. You can find the full documentation for the API here: 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"