Enable dependabot

- dependabot runs weekly
- github-action and bundler are creating
  a single PR for updating
- also integrate automatic release notes
  generation
This commit is contained in:
Andreas Dangel
2024-07-05 10:40:28 +02:00
parent 39750cf158
commit 210e3e59ae
3 changed files with 73 additions and 16 deletions

View File

@@ -126,21 +126,43 @@ echo "Press enter to continue..."
read -r
# calculating stats for release notes
# determine current milestone
MILESTONE_JSON=$(curl -s "https://api.github.com/repos/pmd/pmd/milestones?state=all&direction=desc&per_page=5"|jq ".[] | select(.title == \"$RELEASE_VERSION\")")
MILESTONE=$(echo "$MILESTONE_JSON" | jq .number)
# determine dependency updates
DEPENDENCIES_JSON=$(curl -s "https://api.github.com/repos/pmd/pmd/issues?labels=dependencies&state=closed&direction=asc&per_page=50&page=1&milestone=${MILESTONE}")
DEPENDENCIES_COUNT=$(echo "$DEPENDENCIES_JSON" | jq length)
DEPENDENCIES=""
if [ $DEPENDENCIES_COUNT -gt 0 ]; then
DEPENDENCIES=$(
echo "### 📦 Dependency updates"
echo "$DEPENDENCIES_JSON" | jq --raw-output '.[] | "* [#\(.number)](https://github.com/pmd/pmd/issues/\(.number)): \(.title)"'
)
else
DEPENDENCIES=$(
echo "### 📦 Dependency updates"
echo "No dependency updates"
)
fi
# calculating stats for release notes (excluding dependency updates)
STATS_CLOSED_ISSUES=$(echo "$MILESTONE_JSON" | jq .closed_issues)
STATS=$(
echo "### 📈 Stats"
echo "* $(git log pmd_releases/"${LAST_VERSION}"..HEAD --oneline --no-merges |wc -l) commits"
echo "* $(curl -s "https://api.github.com/repos/pmd/pmd/milestones?state=all&direction=desc&per_page=5"|jq ".[] | select(.title == \"$RELEASE_VERSION\") | .closed_issues") closed tickets & PRs"
echo "* $(($STATS_CLOSED_ISSUES - $DEPENDENCIES_COUNT)) closed tickets & PRs"
echo "* Days since last release: $(( ( $(date +%s) - $(git log --max-count=1 --format="%at" pmd_releases/"${LAST_VERSION}") ) / 86400))"
)
TEMP_RELEASE_NOTES=$(cat docs/pages/release_notes.md)
TEMP_RELEASE_NOTES=${TEMP_RELEASE_NOTES/\{\% endtocmaker \%\}/${STATS//\&/\\\&}$'\n'$'\n'\{\% endtocmaker \%\}}
TEMP_RELEASE_NOTES=${TEMP_RELEASE_NOTES/\{\% endtocmaker \%\}/${DEPENDENCIES//\&/\\\&}$'\n'$'\n'${STATS//\&/\\\&}$'\n'$'\n'\{\% endtocmaker \%\}}
echo "${TEMP_RELEASE_NOTES}" > docs/pages/release_notes.md
echo
echo "Updated stats in release notes:"
echo "Updated dependencies and stats in release notes:"
echo "$DEPENDENCIES"
echo "$STATS"
echo
echo "Please verify docs/pages/release_notes.md"