From 49716a2723cdfd26ed6c314ba57c628f8ece7b75 Mon Sep 17 00:00:00 2001 From: Takahiro Menju Date: Wed, 27 Mar 2024 15:15:39 +0900 Subject: [PATCH 1/2] [CI]Compare with base branch --- .github/workflows/CompareScreenshot.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CompareScreenshot.yml b/.github/workflows/CompareScreenshot.yml index 05af6d24..1b250826 100644 --- a/.github/workflows/CompareScreenshot.yml +++ b/.github/workflows/CompareScreenshot.yml @@ -31,14 +31,16 @@ jobs: uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2 with: gradle-version: wrapper - + - name: Get base branch HEAD commit + id: get_base_branch_head + run: echo "sha=$(git rev-parse origin/${{ github.base_ref }})" >> "$GITHUB_OUTPUT" - uses: dawidd6/action-download-artifact@v2 continue-on-error: true with: name: screenshot workflow: StoreScreenshot.yml - branch: main + commit: ${{ steps.get_base_branch_head.outputs.sha }} - name: compare screenshot test id: compare-screenshot-test @@ -78,4 +80,4 @@ jobs: - uses: actions/upload-artifact@v2 with: name: pr - path: pr/ \ No newline at end of file + path: pr/ From c92aad600a48ade4593b9a4ec9b9bea54ce1cb60 Mon Sep 17 00:00:00 2001 From: Takahiro Menju Date: Wed, 27 Mar 2024 15:35:54 +0900 Subject: [PATCH 2/2] Fix get_base_branch_head --- .github/workflows/CompareScreenshot.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CompareScreenshot.yml b/.github/workflows/CompareScreenshot.yml index 1b250826..0adb8d37 100644 --- a/.github/workflows/CompareScreenshot.yml +++ b/.github/workflows/CompareScreenshot.yml @@ -18,9 +18,10 @@ jobs: actions: write # for upload-artifact steps: - - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - + - name: Checkout base branch + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + with: + ref: ${{ github.base_ref }} - name: Set up JDK 17 uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0 with: @@ -35,6 +36,9 @@ jobs: id: get_base_branch_head run: echo "sha=$(git rev-parse origin/${{ github.base_ref }})" >> "$GITHUB_OUTPUT" + - name: Checkout + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: dawidd6/action-download-artifact@v2 continue-on-error: true with: