-
Notifications
You must be signed in to change notification settings - Fork 2
33 lines (28 loc) · 1.16 KB
/
comment-with-artifact.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
name: Add artifact links to pull request
on:
workflow_run:
workflows: [ "Build JAICF Plugin on PR" ]
types: [ completed ]
jobs:
comment:
name: Create comment with artifacts
runs-on: ubuntu-latest
steps:
- name: Get artifacts id
id: getartid
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: |
URL=${{ github.event.workflow_run.artifacts_url }}
echo "$URL"
GITHUB_ARTIFACTS_ID=$(curl -s -u admin:${{ secrets.GITHUB_TOKEN }} $URL | jq '.artifacts[].id')
echo "$GITHUB_ARTIFACTS_ID"
echo "::set-output name=artid::$GITHUB_ARTIFACTS_ID"
echo "::set-output name=suiteid::${{ github.event.workflow_run.check_suite_id }}"
echo "::set-output name=githubrepo::$GITHUB_REPOSITORY"
- name: Comment pr
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.workflow_run.pull_requests[0].number }}
body: |
The artifacts url is https://github.com/${{ steps.getartid.outputs.githubrepo }}/suites/${{ steps.getartid.outputs.suiteid }}/artifacts/${{ steps.getartid.outputs.artid }}