Skip to content

feat: update Dockerfile and Ansible configurations for improved deplo… #20

feat: update Dockerfile and Ansible configurations for improved deplo…

feat: update Dockerfile and Ansible configurations for improved deplo… #20

name: AI — Update LIVING_CHANGELOG
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: living-changelog-${{ github.ref }}
cancel-in-progress: true
jobs:
aggregate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Collect PR numbers in this push (merge & squash)
id: prs
env:
BEFORE: ${{ github.event.before }}
AFTER: ${{ github.sha }}
run: |
RANGE="${BEFORE}..${AFTER}"
git log --pretty=%B ${RANGE} > .commit_msgs.txt
awk '
match($0, /Merge pull request #([0-9]+)/, m) { print m[1] }
match($0, /\(#([0-9]+)\)/, m) { print m[1] }
' .commit_msgs.txt | sort -u > .pr_numbers.txt
echo "Found PRs:"; cat .pr_numbers.txt || true
PRS_CSV=$(paste -sd, .pr_numbers.txt)
echo "list=${PRS_CSV}" >> "$GITHUB_OUTPUT"
- name: Append per-PR changelogs into docs/LIVING_CHANGELOG.md (## Unreleased)
if: steps.prs.outputs.list != ''
env:
PRS_CSV: ${{ steps.prs.outputs.list }}
run: |
mkdir -p docs
touch docs/LIVING_CHANGELOG.md
if ! grep -q "^## Unreleased" docs/LIVING_CHANGELOG.md; then
{ echo "# Changelog"; echo; echo "## Unreleased"; echo; } \
| cat - docs/LIVING_CHANGELOG.md > tmp && mv tmp docs/LIVING_CHANGELOG.md
fi
IFS=',' read -r -a PRS <<< "$PRS_CSV"
updated=0
for PR in "${PRS[@]}"; do
FILE="docs/changelogs/pr-${PR}.md"
if [ -f "$FILE" ]; then
if ! grep -q "<!-- PR #${PR} " docs/LIVING_CHANGELOG.md; then
awk -v f="$FILE" '
BEGIN{printed=0}
{ print }
/^## Unreleased$/ && !printed {
print ""
while ((getline line < f) > 0) print line
printed=1
}
' docs/LIVING_CHANGELOG.md > tmp && mv tmp docs/LIVING_CHANGELOG.md
updated=1
echo "Appended PR #${PR}."
else
echo "PR #${PR} already present; skipping."
fi
else
echo "No per-PR changelog file for PR #${PR}; skipping."
fi
done
if [ "$updated" = "1" ]; then
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add docs/LIVING_CHANGELOG.md
git commit -m "docs(changelog): append PR(s) to Unreleased"
git push
else
echo "No updates to LIVING_CHANGELOG.md"
fi