|
30 | 30 |
|
31 | 31 | steps: |
32 | 32 |
|
33 | | - - name: Checkout server before PR |
| 33 | + # Check out the PR base branch first so the initial measurements provide |
| 34 | + # a baseline for comparison with the PR changes measured below. |
| 35 | + - name: Check out PR base branch |
34 | 36 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
35 | 37 | with: |
36 | 38 | persist-credentials: false |
@@ -70,11 +72,19 @@ jobs: |
70 | 72 | output: before.json |
71 | 73 | profiler-branch: master |
72 | 74 |
|
73 | | - - name: Apply PR # zizmor: ignore[template-injection] |
| 75 | + - name: Check out PR changes and apply upgrade |
| 76 | + # Switch from the base branch used for the baseline measurements to the |
| 77 | + # fetched PR commit so the after measurements run against the PR changes. |
| 78 | + # |
| 79 | + # Use FETCH_HEAD explicitly so the local branch points to the fetched PR |
| 80 | + # commit rather than the currently checked-out base commit. |
| 81 | + env: |
| 82 | + PR_HEAD_REPO_URL: ${{ github.event.pull_request.head.repo.clone_url }} |
| 83 | + PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} |
74 | 84 | run: | |
75 | | - git remote add pr '${{ github.event.pull_request.head.repo.clone_url }}' |
76 | | - git fetch pr '${{ github.event.pull_request.head.ref }}' |
77 | | - git checkout -b 'pr/${{ github.event.pull_request.head.ref }}' |
| 85 | + git remote add pr-source "$PR_HEAD_REPO_URL" |
| 86 | + git fetch pr-source "$PR_HEAD_REF" |
| 87 | + git checkout -B "pr/$PR_HEAD_REF" FETCH_HEAD |
78 | 88 | git submodule update |
79 | 89 |
|
80 | 90 | ./occ upgrade |
@@ -104,14 +114,16 @@ jobs: |
104 | 114 |
|
105 | 115 | - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v7 |
106 | 116 | if: failure() && steps.compare.outcome == 'failure' |
| 117 | + env: |
| 118 | + COMPARE_OUTPUT: ${{ steps.compare.outputs.compare }} |
107 | 119 | with: |
108 | 120 | github-token: ${{secrets.GITHUB_TOKEN}} |
109 | 121 | script: | |
110 | 122 | let comment = `Possible performance regression detected\n`; |
111 | 123 | comment += `<details><summary>Show Output</summary> |
112 | 124 |
|
113 | 125 | \`\`\` |
114 | | - ${{ steps.compare.outputs.compare }} |
| 126 | + ${process.env.COMPARE_OUTPUT} |
115 | 127 | \`\`\` |
116 | 128 |
|
117 | 129 | </details>`; |
|
0 commit comments