Skip to content

Commit 3aac226

Browse files
authored
Merge pull request #8648 from dhalbert/branch-name-in-build-filename
add branch and PR number to uploaded build filenames
2 parents 2e3e145 + ae4e792 commit 3aac226

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

.github/workflows/build-boards.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ jobs:
7272
working-directory: tools
7373
env:
7474
BOARDS: ${{ matrix.board }}
75+
PULL: ${{ github.event.number }}
7576

7677
- name: Upload artifact
7778
uses: actions/upload-artifact@v3

tools/build_board_info.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,20 @@ def get_version_info():
7575
sha = os.environ["GITHUB_SHA"]
7676

7777
if not version:
78-
version = "{}-{}".format(date.today().strftime("%Y%m%d"), sha[:7])
78+
# Get branch we are PR'ing into, if any.
79+
branch = os.environ.get("GITHUB_BASE_REF", "").strip().replace("/", "_")
80+
if not branch:
81+
branch = "no-branch"
82+
83+
# Get PR number, if any
84+
pull_request_maybe = os.environ.get("PULL", "")
85+
if pull_request_maybe:
86+
pull_request_maybe = f"-PR{pull_request_maybe}"
87+
88+
date_stamp = date.today().strftime("%Y%m%d")
89+
short_sha = sha[:7]
90+
# Example: 20231121-8.2.x-PR9876-123abcd
91+
version = f"{date_stamp}-{branch}{pull_request_maybe}-{short_sha}"
7992

8093
return sha, version
8194

0 commit comments

Comments
 (0)