Skip to content

Commit 70c10a9

Browse files
committed
Refactor CI and Sonar workflows to improve environment variable usage and file handling
1 parent 6551486 commit 70c10a9

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,15 @@ jobs:
5656
if: github.event_name == 'pull_request'
5757
run: |
5858
mkdir pr-metadata
59-
echo "${{ github.event.pull_request.number }}" > pr-metadata/pr_number
60-
echo "${{ github.event.pull_request.base.ref }}" > pr-metadata/pr_base
61-
echo "${{ github.event.pull_request.head.ref }}" > pr-metadata/pr_branch
62-
echo "${{ github.event.pull_request.head.sha }}" > pr-metadata/pr_sha
59+
echo "$env:PR_NUMBER" > pr-metadata/pr_number
60+
echo "$env:PR_BASE" > pr-metadata/pr_base
61+
echo "$env:PR_BRANCH" > pr-metadata/pr_branch
62+
echo "$env:PR_SHA" > pr-metadata/pr_sha
63+
env:
64+
PR_NUMBER: ${{ github.event.pull_request.number }}
65+
PR_BASE: ${{ github.event.pull_request.base.ref }}
66+
PR_BRANCH: ${{ github.event.pull_request.head.ref }}
67+
PR_SHA: ${{ github.event.pull_request.head.sha }}
6368

6469
- name: Upload PR metadata
6570
if: github.event_name == 'pull_request'

.github/workflows/sonar.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ jobs:
3434
archive_format: 'zip',
3535
});
3636
const fs = require('fs');
37-
fs.writeFileSync('${{ runner.temp }}/pr-metadata.zip', Buffer.from(download.data));
37+
const path = require('path');
38+
const zipPath = path.join(process.env.RUNNER_TEMP, 'pr-metadata.zip');
39+
fs.writeFileSync(zipPath, Buffer.from(download.data));
3840
3941
- name: Extract PR metadata
4042
run: |

0 commit comments

Comments
 (0)