From a3e9c3aea18757d94f025b750065fac86982f557 Mon Sep 17 00:00:00 2001 From: softcat477 Date: Mon, 20 Nov 2023 08:30:14 -0500 Subject: [PATCH] feat: Create a feature checklist on release Fix #1103 so testers know what to test for a new release --- .github/workflows/release-bot.yml | 68 +++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/release-bot.yml diff --git a/.github/workflows/release-bot.yml b/.github/workflows/release-bot.yml new file mode 100644 index 000000000..bc0b705ac --- /dev/null +++ b/.github/workflows/release-bot.yml @@ -0,0 +1,68 @@ +name: Create Release checklist +on: + pull_request: + branches: + - "master" + +jobs: + release-checklist: + runs-on: ubuntu-20.04 + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Create output folder + run: mkdir -p ${{ github.workspace }}/checklist_items + - name: Write checklist items to files + id: merge_commits + run: | + git fetch origin master + git fetch origin ${GITHUB_HEAD_REF} + MERGE_COMMITS=$(git --no-pager log origin/${GITHUB_HEAD_REF} ^origin/master --oneline --merges --grep "Merge pull request" --pretty=format:"%h") + + for COMMIT in $MERGE_COMMITS; do + # Merge commit title + checkitem_title=$(git --no-pager show $COMMIT --pretty=format:"%s" | head -n 1 | sed 's/Merge\ pull\ request\ //' | sed 's/from.*\///') + # Commits inside this pull request + details=$(git --no-pager log $COMMIT^1..$COMMIT^2 --oneline | sed 's/[a-f0-9]*\ /- /') + + content="- [ ] ${checkitem_title} +
details + + \`\`\` + ${details} + \`\`\` +
+ " + echo "$content" > checklist_items/$COMMIT.log + done + + - name: Collect checklist items + run: | + msg=$(awk 'FNR==1 && NR!=1 {print "---"}{print}' checklist_items/*.log) + echo "$msg" >> aggregated.log + sha="*SHA: ${{ github.event.pull_request.head.sha }}*" + sed -i "1i\\ + $sha + " aggregated.log + + - name: Update Pull Request + uses: actions/github-script@v5 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const fs = require('fs'); + + fs.readFile('aggregated.log', 'utf8', (err, data) => { + if (err) { + console.error(err); + } else { + const output = data; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: output + }) + } + }); \ No newline at end of file