diff --git a/.github/workflows/benchmark-ssr.yml b/.github/workflows/benchmark-ssr.yml index ca4d082b049..a5ebe1e6b2d 100644 --- a/.github/workflows/benchmark-ssr.yml +++ b/.github/workflows/benchmark-ssr.yml @@ -7,7 +7,9 @@ on: paths: - .github/workflows/benchmark-ssr.yml - "packages/yew/**" + - "packages/yew-macro/**" - "packages/yew-router/**" + - "packages/yew-router-macro/**" - "examples/function_router/**" - "tools/benchmark-ssr/**" @@ -56,11 +58,16 @@ jobs: run: cargo run --profile=bench --bin benchmark-ssr -- --output-path ./output.json working-directory: yew-master/tools + - name: Write Pull Request ID + run: | + echo "${{ github.event.number }}" > .PR_NUMBER + - name: Upload Artifact uses: actions/upload-artifact@v2 with: name: benchmark-ssr path: | + .PR_NUMBER yew-master/tools/output.json current-pr/tools/output.json retention-days: 1 diff --git a/.github/workflows/post-benchmark-ssr.yml b/.github/workflows/post-benchmark-ssr.yml index e564e93fb6b..69f5892e4e2 100644 --- a/.github/workflows/post-benchmark-ssr.yml +++ b/.github/workflows/post-benchmark-ssr.yml @@ -9,6 +9,7 @@ on: jobs: post-benchmark-ssr: + if: github.event.workflow_run.event == 'pull_request' name: Post Comment on Pull Request runs-on: ubuntu-latest @@ -16,8 +17,7 @@ jobs: - name: Download Repository uses: actions/checkout@v2 - - if: github.event.workflow_run.event == 'pull_request' - name: Download Artifact + - name: Download Artifact uses: Legit-Labs/action-download-artifact@v2 with: github_token: "${{ secrets.GITHUB_TOKEN }}" @@ -29,6 +29,15 @@ jobs: - name: Make pull request comment run: python3 ci/make_benchmark_ssr_cmt.py + - name: Read Pull Request ID + run: | + PR_NUMBER=$(cat "benchmark-ssr/.PR_NUMBER") + if ! [[ "$PR_NUMBER" =~ ^[0-9]+$ ]]; then + echo "pr number invalid" + exit 1 + fi + echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV + - name: Post Comment uses: actions/github-script@v6 with: diff --git a/ci/make_benchmark_ssr_cmt.py b/ci/make_benchmark_ssr_cmt.py index 068ecb25f09..5d49f21a05c 100644 --- a/ci/make_benchmark_ssr_cmt.py +++ b/ci/make_benchmark_ssr_cmt.py @@ -49,7 +49,6 @@ def main() -> None: with open(os.environ["GITHUB_ENV"], "a+") as f: f.write(f"YEW_BENCH_SSR={json.dumps(output)}\n") - f.write(f"PR_NUMBER={issue_number}\n") if __name__ == "__main__":