From 2ebf8f1efe156caf3296e770465fe266d67fabc3 Mon Sep 17 00:00:00 2001 From: IWANABETHATGUY Date: Thu, 1 Jun 2023 22:50:27 +0800 Subject: [PATCH] fix: metric recover (#3388) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: 🤖 init * chore: 🤖 print log * chore: 🤖 remove out.md when no diff * chore: 🤖 test diff * chore: 🤖 recover --- .github/workflows/reusable-build.yml | 12 ++++++------ webpack-test/scripts/pr-diff.js | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index e9857271182..80f5e860b15 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -234,9 +234,9 @@ jobs: run: node ./webpack-test/scripts/generate.js ${{ secrets.GITHUB_TOKEN }} ${{ github.sha }} # ### update metric diff against main branch when pull request change - # - name: Update - # if: ${{ inputs.target == 'x86_64-unknown-linux-gnu' && github.event_name == 'pull_request' && matrix.node == '18' }} - # uses: ./.github/actions/webpack-test-metric-diff - # with: - # github-token: ${{ secrets.GITHUB_TOKEN }} - # sha: ${{ github.sha }} + - name: Update + if: ${{ inputs.target == 'x86_64-unknown-linux-gnu' && github.event_name == 'pull_request' && matrix.node == '18' }} + uses: ./.github/actions/webpack-test-metric-diff + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + sha: ${{ github.sha }} diff --git a/webpack-test/scripts/pr-diff.js b/webpack-test/scripts/pr-diff.js index 3c84881dab6..b419270329c 100644 --- a/webpack-test/scripts/pr-diff.js +++ b/webpack-test/scripts/pr-diff.js @@ -47,6 +47,7 @@ const [, , token, commit_sha] = process.argv; let lastestMainCommit = indexList[indexList.length - 1]; let latestMainCommitData = historyData[lastestMainCommit]; + console.log(latestMainCommitData); let currentCompatibility = currentData["Tests Compatibility"]; let lastestMainCommitCompatibility = @@ -70,6 +71,8 @@ ${lastestMainCommitCompatibility},${currentCompatibility},${`${icon} ${diff.toFi true, ); fs.appendFileSync(path.resolve(rootDir, "output.md"), markdown); + } else { + fs.rmSync(path.resolve(rootDir, "output.md")); } break;