From 2650daedcfb300e81bc453757e2ad9e548a7ef13 Mon Sep 17 00:00:00 2001 From: Gilver Date: Wed, 7 May 2025 08:03:44 -0500 Subject: [PATCH] feat(ci): better autoupdate commit messages (#4720) (#4738) * feat(ci): better autoupdate commit messages * fix: also sort (cherry picked from commit 7de992923bfeee7f2f7c9cb0e6e6b544d6428bf8) Signed-off-by: RockGrub Co-authored-by: madomado --- .github/workflows/update-branch.yml | 2 +- .github/workflows/update-nightly.yml | 2 +- .github/workflows/update-weekly.yml | 2 +- .github/workflows/update.yml | 2 +- andax/ci/update_commit_message.rhai | 13 +++++++++++++ 5 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 andax/ci/update_commit_message.rhai diff --git a/.github/workflows/update-branch.yml b/.github/workflows/update-branch.yml index 341b9b92bf..81e60b1378 100644 --- a/.github/workflows/update-branch.yml +++ b/.github/workflows/update-branch.yml @@ -48,7 +48,7 @@ jobs: git config user.email "raboneko@fyralabs.com" git config gpg.format "ssh" git config user.signingkey "${{ runner.temp }}/signing_key" - msg="bump(branch): $(git status | grep modified | sed -r 's@.+/([^/]+)/[^/]+\n?@\1 @g' | tr -d '\n')" + msg="bump(branch): $(anda run andax/ci/update_commit_message.rhai)" git commit -S -a -m "$msg" git push -u origin --all fi diff --git a/.github/workflows/update-nightly.yml b/.github/workflows/update-nightly.yml index ca08a20b2a..4f17ce3dff 100644 --- a/.github/workflows/update-nightly.yml +++ b/.github/workflows/update-nightly.yml @@ -37,7 +37,7 @@ jobs: git config user.email "raboneko@fyralabs.com" git config gpg.format "ssh" git config user.signingkey "${{ runner.temp }}/signing_key" - msg="bump(nightly): $(git status | grep modified | sed -r 's@.+/([^/]+)/[^/]+\n?@\1 @g' | tr -d '\n')" + msg="bump(nightly): $(anda run andax/ci/update_commit_message.rhai)" git commit -S -a -m "$msg" git format-patch HEAD^ copy_over () { diff --git a/.github/workflows/update-weekly.yml b/.github/workflows/update-weekly.yml index c94e47a7e7..5bcb4b2aa6 100644 --- a/.github/workflows/update-weekly.yml +++ b/.github/workflows/update-weekly.yml @@ -37,7 +37,7 @@ jobs: git config user.email "raboneko@fyralabs.com" git config gpg.format "ssh" git config user.signingkey "${{ runner.temp }}/signing_key" - msg="bump(weekly): $(git status | grep modified | sed -r 's@.+/([^/]+)/[^/]+\n?@\1 @g' | tr -d '\n')" + msg="bump(weekly): $(anda run andax/ci/update_commit_message.rhai)" git commit -S -a -m "$msg" git format-patch HEAD^ copy_over () { diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 0b614ed246..e8f3a0d45f 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -37,7 +37,7 @@ jobs: git config user.email "raboneko@fyralabs.com" git config gpg.format "ssh" git config user.signingkey "${{ runner.temp }}/signing_key" - msg="bump: $(git status | grep modified | sed -r 's@.+/([^/]+)/[^/]+\n?@\1 @g' | tr -d '\n')" + msg="bump: $(anda run andax/ci/update_commit_message.rhai)" git commit -S -a -m "$msg" git format-patch HEAD^ copy_over () { diff --git a/andax/ci/update_commit_message.rhai b/andax/ci/update_commit_message.rhai new file mode 100644 index 0000000000..889800652c --- /dev/null +++ b/andax/ci/update_commit_message.rhai @@ -0,0 +1,13 @@ +import "anda::cfg" as cfg; + +let cmd = `git status | sed -nE '/^\tmodified:/{s@^\tmodified:\s+@@;s@[^/]+$@@;p}' | sort -u`; +let filelist = sh(cmd, #{ "stdout": "piped" }).ctx.stdout.split('\n'); + +let modified_list = ""; +for file in filelist { + if file.is_empty() { continue; } + let spec = cfg::load_file(`${file}/anda.hcl`).project.pkg.rpm.spec; + spec.pop(5); // remove `.spec` suffix + modified_list += `${spec} `; +} +print(modified_list[..modified_list.len()-1]);