Skip to content

Commit

Permalink
chore: test comment
Browse files Browse the repository at this point in the history
  • Loading branch information
bkirb committed Oct 3, 2024
1 parent 607adff commit 83149c1
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions .github/workflows/label-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,19 @@ on:
- labeled

jobs:
label_comment:
runs-on: ubuntu-latest
pre-comment:
if: github.event.label.name == 'asdf'
runs-on: ubuntu-latest
steps:
- name: Create a comment
id: create_comment
run: |
COMMENT=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
-X POST \
-d "{\"body\": \"Created comment. Comment ID: ${{ github.run_id }}\"}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments")
echo $COMMENT
COMMENT_ID=$(echo $COMMENT | jq -r '.id')
echo "::set-output name=comment_id::$COMMENT_ID"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update the comment
run: |
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
-X PATCH \
-d "{\"body\": \"Updated comment. Comment ID: ${{ github.run_id }}\"}" \
"https://api.github.com/repos/${{ github.repository }}/issues/comments/${{ steps.create_comment.outputs.comment_id }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add a comment with link to workflow
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
github.rest.issues.createComment({
issue_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Ramps E2E tests are running. You can see the results [here](${runUrl}).`
});

0 comments on commit 83149c1

Please sign in to comment.