Skip to content

Commit 8546397

Browse files
committed
run_id
1 parent 9d4467f commit 8546397

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

.github/workflows/measure-disk-usage.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,24 @@ jobs:
4646
run: |
4747
ddev config override
4848
49+
- name: Determine commit SHAs
50+
id: commits
51+
run: |
52+
if [ "${{ github.event_name }}" = "pull_request" ]; then
53+
echo "current_sha=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_OUTPUT"
54+
echo "base_sha=${{ github.event.pull_request.base.sha }}" >> "$GITHUB_OUTPUT"
55+
elif [ "${{ github.event_name }}" = "push" ]; then
56+
echo "current_sha=${{ github.sha }}" >> "$GITHUB_OUTPUT"
57+
echo "base_sha=${{ github.event.before }}" >> "$GITHUB_OUTPUT"
58+
fi
59+
4960
- name: Measure disk usage
5061
run: |
5162
cmd="python .github/workflows/scripts/measure-disk-usage.py \
52-
--current-commit ${{ github.event.pull_request.head.sha }} \
53-
--base-commit ${{ github.event.pull_request.base.sha }} \
63+
--current-commit ${{ steps.commits.outputs.current_sha }} \
64+
--base-commit ${{ steps.commits.outputs.base_sha }} \
5465
--platform ${{ matrix.platform }} "
55-
66+
--run-id ${{ github.run_id }}
5667
# Send metrics to Datadog only on push to default branch
5768
if [ "${{ github.event_name }}" = "push" ] && [ "${{ github.ref_name }}" = "${{ github.event.repository.default_branch }}" ]; then
5869
cmd="$cmd --to-dd-key ${{ secrets.DD_API_KEY }}"

.github/workflows/scripts/measure-disk-usage.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def get_run_id(commit, workflow):
3838
return run_id
3939

4040

41-
def get_dep_sizes_json(current_commit, platform):
41+
def get_dep_sizes_json(current_commit, platform, run_id):
4242
print(f"Getting dependency sizes json for commit: {current_commit}, platform: {platform}")
43-
run_id = get_run_id(current_commit, '.github/workflows/resolve-build-deps.yaml')
43+
# run_id = get_run_id(current_commit, '.github/workflows/resolve-build-deps.yaml')
4444
if run_id and check_artifact_exists(run_id, f'target-{platform}'):
4545
dep_sizes_json = get_current_sizes_json(run_id, platform)
4646
print(f"Dependency sizes json path: {dep_sizes_json}")
@@ -176,9 +176,10 @@ def main():
176176
parser.add_argument('--base-commit', required=True, help='Base commit hash')
177177
parser.add_argument('--platform', required=True, help='Platform to compare')
178178
parser.add_argument('--to-dd-key', required=False, help='Send to Datadog')
179+
parser.add_argument('--run-id', required=False, help='Run id')
179180
args = parser.parse_args()
180181

181-
dep_sizes_json = get_dep_sizes_json(args.current_commit, args.platform)
182+
dep_sizes_json = get_dep_sizes_json(args.current_commit, args.platform, args.run_id)
182183
if not dep_sizes_json:
183184
dep_sizes_json = get_previous_dep_sizes_json(args.base_commit, args.platform)
184185

0 commit comments

Comments
 (0)