add branch and PR number to uploaded build filenames

This commit is contained in:
Dan Halbert 2023-11-22 00:11:11 -05:00
parent b2c32cf42f
commit 0bd2a377b3
2 changed files with 17 additions and 1 deletions

View File

@ -84,6 +84,7 @@ jobs:
run: python3 -u ci_set_matrix.py
working-directory: tools
env:
PULL: ${{ github.event.number }}
LAST_FAILED_JOBS: ${{ steps.get-last-commit-with-checks.outputs.check_runs }}
tests:
@ -294,3 +295,5 @@ jobs:
with:
boards: ${{ toJSON(fromJSON(needs.scheduler.outputs.ports)[matrix.port]) }}
cp-version: ${{ needs.scheduler.outputs.cp-version }}
env:
PULL: ${{ github.event.number }}

View File

@ -75,7 +75,20 @@ def get_version_info():
sha = os.environ["GITHUB_SHA"]
if not version:
version = "{}-{}".format(date.today().strftime("%Y%m%d"), sha[:7])
# Get branch we are PR'ing into, if any.
branch = os.environ.get("GITHUB_BASE_REF", "").strip().replace("/", "_")
if not branch:
branch = "no-branch"
# Get PR number, if any
pull_request_maybe = os.environ.get("PULL", "")
if pull_request_maybe:
pull_request_maybe = f"-PR{pull_request_maybe}"
date_stamp = date.today().strftime("%Y%m%d")
short_sha = sha[:7]
# Example: 20231121-8.2.x-PR9876-123abcd
version = f"{date_stamp}-{branch}{pull_request_maybe}-{short_sha}"
return sha, version