build(deps): Bump nanoid and mocha in /api/typescript #10009
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Update Breaking Change With Conventional Commits" | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- edited | |
- synchronize | |
# cancel redundant builds | |
concurrency: | |
group: "update-breaking-change-${{ github.ref }}" | |
cancel-in-progress: true | |
jobs: | |
update_pr: | |
# we want this to only run on breaking-release PRs | |
if: contains(github.head_ref, 'release-please') != true && contains(github.head_ref, 'breaking-release') == true | |
runs-on: ubuntu-latest | |
steps: | |
- uses: 8BitJonny/gh-get-current-pr@3 | |
with: | |
sha: ${{ github.event.pull_request.head.sha }} | |
id: PR | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- run: | | |
pr_body=$(cat << EOF | |
${{ steps.PR.outputs.pr_body }} | |
EOF | |
) | |
delimiter="Changelog picked up from commits here:" | |
cleaned_body="${pr_body%${delimiter}*}" | |
cleaned_body_without_trailing_space="$(python .github/remove_trailing_space.py "${cleaned_body}")" | |
conventional_commits="$(git log --pretty=format:"%B" origin/main..HEAD | grep -Pio '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|¯\\_\(ツ\)_\/¯)(\(\w+\)?((?=:\s)|(?=!:\s)))?(!)?(:\s.*)?(\n\n.*)?$' | grep ':' || true)" | |
title="$(python .github/breaking_change_title.py "${conventional_commits}")" | |
echo "CONVENTIONAL_TITLE=${title}" >> $GITHUB_ENV | |
remaining_commits="$(python .github/breaking_change_description.py "${conventional_commits}")" | |
echo "MODIFIED_BODY<<EOF" >> $GITHUB_ENV | |
echo "${cleaned_body_without_trailing_space}" >> ${GITHUB_ENV} | |
if [ ${#remaining_commits} -gt 0 ]; then | |
echo "" >> ${GITHUB_ENV} | |
echo "${delimiter}" >> ${GITHUB_ENV} | |
echo "" >> ${GITHUB_ENV} | |
echo "${remaining_commits}" >> $GITHUB_ENV | |
fi | |
echo 'EOF'>> $GITHUB_ENV | |
- uses: tzkhan/pr-update-action@v2 | |
with: | |
repo-token: "${{ secrets.GITHUB_TOKEN }}" | |
# added this though it isn't used | |
base-branch-regex: '[a-z\d-_.\\/]+' | |
body-template: | | |
${{ env.MODIFIED_BODY }} | |
body-update-action: 'replace' | |
body-uppercase-base-match: false | |
title-update-action: 'replace' | |
title-template: ${{ env.CONVENTIONAL_TITLE }} |