You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2023/05/31 07:18:39 UTC
[camel] branch main updated: component-test - Set right permissions
This is an automated email from the ASF dual-hosted git repository.
nfilotto pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new b94d3e5445a component-test - Set right permissions
b94d3e5445a is described below
commit b94d3e5445a6a11181333e031014d056305fc99e
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Wed May 31 09:18:09 2023 +0200
component-test - Set right permissions
---
.../{pr-comment-main.yml => pr-comment.yml} | 27 ++++++++++++++++------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/.github/workflows/pr-comment-main.yml b/.github/workflows/pr-comment.yml
similarity index 73%
rename from .github/workflows/pr-comment-main.yml
rename to .github/workflows/pr-comment.yml
index 52c606776ce..5dc26b35a2f 100644
--- a/.github/workflows/pr-comment-main.yml
+++ b/.github/workflows/pr-comment.yml
@@ -25,7 +25,8 @@ jobs:
name: PR comment
if: github.repository == 'apache/camel' && ${{ github.event.issue.pull_request }} && contains(github.event.comment.body, '/component-test')
permissions:
- issues: write
+ pull-requests: write # to comment on a pull request
+ actions: read # to download artifact
runs-on: ubuntu-latest
strategy:
matrix:
@@ -64,12 +65,13 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
- await github.rest.issues.createComment({
+ await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
- body: `**Result of** ${{ github.event.comment.body }}
- :hooray: The tests passed successfully`
+ comment_id: ${{ github.event.comment.id }},
+ body: `${{ github.event.comment.body }}
+ **Result** :white_check_mark: The tests passed successfully`
});
- name: Failure comment
if: failure()
@@ -77,11 +79,22 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
- await github.rest.issues.createComment({
+ var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ run_id: ${{github.event.workflow_run.id }},
+ });
+ var message = `${{ github.event.comment.body }}
+ **Result** :x: The tests failed please check the logs below:
+ `
+ for (artifact in artifacts.data.artifacts) {
+ message += `* [*${artifact.name}*](${artifact.url})`
+ }
+ await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
- body: `**Result of** ${{ github.event.comment.body }}
- :confused: The tests failed please check the logs`
+ comment_id: ${{ github.event.comment.id }},
+ body: message
});