-
Notifications
You must be signed in to change notification settings - Fork 35
66 lines (56 loc) · 2.5 KB
/
dependency-diff-comment.yaml
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Dependency Diff Comment
on:
workflow_run:
workflows: ["Dependency Diff Report"]
types:
- completed
jobs:
comment-dependency-diff:
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
pull-requests: write
env:
LOG_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}
steps:
- name: Download PR number artifact
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # v2
with:
name: pr
run_id: ${{ github.event.workflow_run.id }}
- name: Get pull request number
id: get-pr-number
run: |
PR_NUMBER=$(cat NR)
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
- name: Download dependency diff artifacts
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # v2
with:
name: dependency-diff
run_id: ${{ github.event.workflow_run.id }}
path: dependency-diff
- name: Process dependency diff reports
id: process-diff
run: |
report_library_exists_diff=$(grep 'exists-diff=' dependency-diff/report-library.txt | cut -d'=' -f2)
report_plugin_exists_diff=$(grep 'exists-diff=' dependency-diff/report-plugin.txt | cut -d'=' -f2)
echo "report_library_exists_diff=$report_library_exists_diff" >> $GITHUB_ENV
echo "report_plugin_exists_diff=$report_plugin_exists_diff" >> $GITHUB_ENV
- name: Comment on PR for library
if: env.report_library_exists_diff == 'true' || failure()
uses: yumemi-inc/comment-pull-request@v1
with:
pull-request-number: ${{ env.PR_NUMBER }}
comment: ':warning: There are differences in library dependencies. See details [here](${{ env.LOG_URL }}).'
comment-if-failure: ':exclamation: Report workflow failed. See details [here](${{ env.LOG_URL }}).'
- name: Comment on PR for plugin
if: env.report_plugin_exists_diff == 'true' || failure()
uses: yumemi-inc/comment-pull-request@v1
with:
pull-request-number: ${{ env.PR_NUMBER }}
comment: ':warning: There are differences in plugin dependencies. See details [here](${{ env.LOG_URL }}).'
comment-if-failure: ':exclamation: Report workflow failed. See details [here](${{ env.LOG_URL }}).'