Comments (6)
I'm not sure is there a token for github-actions bot?
from commit-comment.
The problem is not github-actions bot, this action will failed if body is empty
from commit-comment.
The problem is not github-actions bot, this action will failed if body is empty
Fix in pull #59
Oh #59 didn't fix this but I still think it is necessary
from commit-comment.
Hi @Arondight
If you use the action with the default GITHUB_TOKEN
then the comment will be created by the github actions bot user. If you use a PAT then the comment will be created by the user the PAT is associated with.
from commit-comment.
@peter-evans hi, can you tell me how to comment as a code block? I update action like this
diff --git a/.github/workflows/code_check.yml b/.github/workflows/code_check.yml
index c2339f45..9cef2f9f 100644
--- a/.github/workflows/code_check.yml
+++ b/.github/workflows/code_check.yml
@@ -26,7 +26,7 @@ jobs:
uses: peter-evans/commit-comment@v1
if: ${{ '' != steps.check-code.outputs.result }}
with:
- body: ${{ steps.check-code.outputs.result }}
+ body: "```${{ steps.get-comment-body.outputs.body }}'%0A'```"
- name: Error if check failed
if: ${{ '' != steps.check-code.outputs.result }}
run: exit -1
But i got
I dont known how to do ...
I wrote wrong var, but in fact I get nothing from var in string
diff --git a/.github/workflows/code_check.yml b/.github/workflows/code_check.yml
index 9cef2f9f..df4c3977 100644
--- a/.github/workflows/code_check.yml
+++ b/.github/workflows/code_check.yml
@@ -26,7 +26,7 @@ jobs:
uses: peter-evans/commit-comment@v1
if: ${{ '' != steps.check-code.outputs.result }}
with:
- body: "```${{ steps.get-comment-body.outputs.body }}'%0A'```"
+ body: "```${{ steps.get-comment-body.outputs.result }}\n```"
- name: Error if check failed
if: ${{ '' != steps.check-code.outputs.result }}
run: exit -1
from commit-comment.
finally I done this
diff --git a/.github/workflows/code_check.yml b/.github/workflows/code_check.yml
index c2339f4..576df98 100644
--- a/.github/workflows/code_check.yml
+++ b/.github/workflows/code_check.yml
@@ -7,7 +7,7 @@ on:
- master
jobs:
- resources_update:
+ code_check:
runs-on: ubuntu-latest
steps:
- name: Checkout
@@ -17,16 +17,20 @@ jobs:
- name: Check code
id: check-code
run: |
- result=$(npm run --silent check || :)
- result="${result//'%'/'%25'}"
- result="${result//$'\n'/'%0A'}"
- result="${result//$'\r'/'%0D'}"
- echo ::set-output name=result::"$result"
+ check_output=$(npm run --silent check || :)
+ check_failed='true'
+ [[ -z "$check_output" ]] && check_failed='false'
+ check_output=$(echo -e "\`\`\`${check_output}\n\`\`\`")
+ check_output="${check_output//'%'/'%25'}"
+ check_output="${check_output//$'\n'/'%0A'}"
+ check_output="${check_output//$'\r'/'%0D'}"
+ echo ::set-output name=check_output::"$check_output"
+ echo ::set-output name=check_failed::"$check_failed"
- name: Comment if check failed
uses: peter-evans/commit-comment@v1
- if: ${{ '' != steps.check-code.outputs.result }}
+ if: ${{ 'true' == steps.check-code.outputs.check_failed }}
with:
- body: ${{ steps.check-code.outputs.result }}
+ body: ${{ steps.check-code.outputs.check_output }}
- name: Error if check failed
- if: ${{ '' != steps.check-code.outputs.result }}
+ if: ${{ 'true' == steps.check-code.outputs.check_failed }}
run: exit -1
from commit-comment.
Related Issues (9)
- accept `body-path` HOT 3
- Documentation update: Use `head_ref` for comments on PR commits? HOT 4
- Option to use an output file HOT 1
- Help request: How to comment on a PR, not the commit HOT 1
- comment commit with output of something HOT 2
- Getting the following error in my workflow when trying to use this action HOT 1
- Github removed commit comment from the PR timeline HOT 1
- Replace existing commit HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from commit-comment.