Skip to content

Commit 98c1f7f

Browse files
committed
feat: Allow overriding the base/head names for better Release notes
1 parent bd648ca commit 98c1f7f

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ jobs:
139139
with:
140140
app_name: "My ESP-IDF App"
141141
app_path: "."
142+
head_name: "${{ github.event.release.tag_name }}"
143+
base_name: "${{ steps.base.outputs.ref }}"
142144
idf_target: esp32s3
143145
idf_version: v5.5
144146
idf_component_manager: "1" # enable component manager
@@ -168,6 +170,14 @@ inputs:
168170
description: 'Set IDF_COMPONENT_MANAGER ("0" to disable)'
169171
required: false
170172
default: '0'
173+
head_name:
174+
description: 'Name of the head app (for reporting, defaults to "PR")'
175+
required: false
176+
default: 'PR'
177+
base_name:
178+
description: 'Name of the base app (for reporting, defaults to "Base")'
179+
required: false
180+
default: 'Base'
171181
base_ref:
172182
description: 'Git ref/sha to use as base for delta (defaults to PR base sha)'
173183
required: false

action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ inputs:
2020
description: 'Set IDF_COMPONENT_MANAGER ("0" to disable)'
2121
required: false
2222
default: '0'
23+
head_name:
24+
description: 'Name of the head app (for reporting, defaults to "PR")'
25+
required: false
26+
default: 'PR'
27+
base_name:
28+
description: 'Name of the base app (for reporting, defaults to "Base")'
29+
required: false
30+
default: 'Base'
2331
base_ref:
2432
description: 'Git ref/sha to use as base for delta (defaults to PR base sha)'
2533
required: false
@@ -108,7 +116,7 @@ runs:
108116
shell: bash
109117
run: |
110118
# generate markdown
111-
md=$(${{ steps.id_python_313.outputs.python-path }} ${{ github.action_path }}/render_markdown.py --app-name "${{ inputs.app_name }}" --head-json head/${{ inputs.app_path }}/size.json --base-json base/${{ inputs.app_path }}/size.json)
119+
md=$(${{ steps.id_python_313.outputs.python-path }} ${{ github.action_path }}/render_markdown.py --app-name "${{ inputs.app_name }}" --base-name "${{ inputs.base_name }}" --head-name "${{ inputs.head_name }}" --head-json head/${{ inputs.app_path }}/size.json --base-json base/${{ inputs.app_path }}/size.json)
112120
# append to summary and set output
113121
echo "$md" >> "$GITHUB_STEP_SUMMARY"
114122
echo "markdown<<EOF" >> $GITHUB_OUTPUT

render_markdown.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ def fmt_delta(delta: int, delta_pct: Optional[float], precision: int) -> str:
3636
def main():
3737
ap = argparse.ArgumentParser(description="Render markdown size table for ESP-IDF app")
3838
ap.add_argument("--app-name", required=True)
39+
ap.add_argument("--base-name", required=False, help="Name of base branch/commit/tag", default="Base")
40+
ap.add_argument("--head-name", required=False, help="Name of head branch/commit/tag", default="PR")
3941
ap.add_argument("--head-json", required=True, help="Path to head size.json")
4042
ap.add_argument("--base-json", required=True, help="Path to base size.json")
4143
ap.add_argument("--flash-total-override", type=int, default=0)
@@ -117,7 +119,7 @@ def fmt_row(label: str, key: str, show_pct: bool) -> str:
117119
md = [
118120
f"### ESP-IDF Size Report for '{args.app_name}'",
119121
"",
120-
"| Metric | Base | PR | Delta |",
122+
f"| Metric | {args.base_name} | {args.head_name} | Delta |",
121123
"|---|---:|---:|---:|",
122124
*rows,
123125
"",

0 commit comments

Comments
 (0)