-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #514 from takahirom/takahirom/add-dependecy-diff/2…
…024-10-28 Add dependency diff
- Loading branch information
Showing
2 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
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 | ||
|
||
steps: | ||
- name: Download PR number artifact | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
name: pr | ||
run_id: ${{ github.event.workflow_run.id }} | ||
|
||
- name: Get pull request number | ||
id: get-pr-number | ||
run: | | ||
PR_NUMBER=$(cat pr/NR) | ||
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV | ||
- name: Download dependency diff artifacts | ||
uses: dawidd6/action-download-artifact@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/outputs/report-library.txt | cut -d'=' -f2) | ||
report_plugin_exists_diff=$(grep 'exists-diff=' dependency-diff/outputs/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 }}).' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Dependency Diff Report | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
report: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
env: | ||
LOG_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
steps: | ||
- uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 | ||
with: | ||
distribution: 'zulu' | ||
java-version: 19 | ||
- name: Generate dependency diff report for library | ||
uses: yumemi-inc/gradle-dependency-diff-report@v2 | ||
id: report-library | ||
with: | ||
configuration: 'releaseRuntimeClasspath' | ||
modules: | | ||
roborazzi-compose-ios|commonMainImplementationDependenciesMetadata | ||
roborazzi-compose-desktop|commonMainImplementationDependenciesMetadata | ||
roborazzi | ||
roborazzi-compose | ||
roborazzi-compose-preview-scanner-support | ||
- name: Save report-library outputs | ||
run: | | ||
mkdir -p outputs | ||
echo "exists-diff=${{ steps.report-library.outputs.exists-diff }}" > outputs/report-library.txt | ||
- name: Generate dependency diff report for plugin | ||
uses: yumemi-inc/gradle-dependency-diff-report@v2 | ||
id: report-plugin | ||
with: | ||
modules: 'roborazzi-gradle-plugin' | ||
configuration: 'runtimeClasspath' | ||
project-dir: 'include-build' | ||
|
||
- name: Save report-plugin outputs | ||
run: | | ||
echo "exists-diff=${{ steps.report-plugin.outputs.exists-diff }}" > outputs/report-plugin.txt | ||
- name: Save PR number | ||
if: ${{ github.event_name == 'pull_request' }} | ||
run: | | ||
mkdir -p pr | ||
echo ${{ github.event.number }} > pr/NR | ||
- name: Upload Dependency Diff Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dependency-diff | ||
path: outputs/ | ||
retention-days: 30 | ||
|
||
- name: Upload PR Number Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: pr | ||
path: pr/ | ||
retention-days: 30 |