Skip to content

Merge pull request #4 from RejektsConference/decisions-wrokflow-action #1

Merge pull request #4 from RejektsConference/decisions-wrokflow-action

Merge pull request #4 from RejektsConference/decisions-wrokflow-action #1

name: Update the decisions README with a list of decisions
on:
push:
branches:
- main
permissions:
contents: write
jobs:
merge-md:
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run update script
run: |
DECISIONS=""
for file in decision-record/*.md; do
if [[ "${file}" != "decision-record/README.md" ]]; then
FILENAME=$(echo ${file} | cut -f 2 -d '/')
TITLE=$(cat ${file} | grep '^# .+' | cut -f 2- -d " ")
STATUS=$(cat ${file} | grep '\*\*Status:\*\* .+' | cut -f 2- -d " ")
if [[ "${STATUS}" == "Approved" ]]; then
DECISIONS="${DECISIONS}\n - [${TITLE}](./${FILENAME}) [${STATUS}]"
fi
fi
done
sed -i -E ":a;N;\$\!ba;s|(<\!-- DO NOT EDIT - AUTOGENERATED -->).*(<\!-- END OF AUTOGENERATED -->)|\1${DECISIONS}\n\2|g" decision-record/README.md
- name: Commit and push changes
run: |
git add README.md
if git diff --cached --quiet; then
echo "No changes to commit."
exit 0
fi
git commit -m "Auto: Updated README.md with all approved decisions [skip ci]"
git push