Skip to content

remove space before fenced codeblock info string. #209

remove space before fenced codeblock info string.

remove space before fenced codeblock info string. #209

Workflow file for this run

name: Prepare release branch
on:
workflow_dispatch:
pull_request_target:
types:
- closed
permissions:
contents: write
pull-requests: write
jobs:
prepare:
if: ${{ github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
version: ${{ steps.version-label.outputs.version }}
steps:
- uses: actions/checkout@v5
with:
submodules: true
- name: Configure Git
run: |
git config --local user.email "[email protected]"
git config --local user.name "Actions Auto Build"
- name: Get current version
id: version-label
run: |
VERSION=$(grep version Cargo.toml | head -n 1 | cut -d'"' -f2)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Get previous version
id: previous-version-label
run: |
PREVIOUS_VERSION=$(gh api "/repos/${{ github.repository }}/tags?per_page=1" | jq -r '.[] | .name?')
echo "previous_version=${PREVIOUS_VERSION}" >> $GITHUB_OUTPUT
- name: Generate Release Notes
id: generate-release-notes
run: |
generate() {
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/releases/generate-notes \
-f tag_name='v${{ steps.version-label.outputs.version }}' \
-f previous_tag='v${{ steps.previous-version-label.outputs.previous_version }}' \
| jq -r ".body"
}
echo "changelog<<EOF"$'\n'"$(generate)"$'\n'EOF >> $GITHUB_OUTPUT
- name: Update CHANGELOG.md
run: |
echo "# [v${{ steps.version-label.outputs.version }}] - `date +%Y-%m-%d`" >> CHANGELOG.md.tmp
cat <<'EOF' >> CHANGELOG.md.tmp
${{steps.generate-release-notes.outputs.changelog}}
---snip---
EOF
cat CHANGELOG.md >> CHANGELOG.md.tmp
mv CHANGELOG.md.tmp CHANGELOG.md
- name: Update README
run: |
cargo run --example update-readme
- name: Commit Changelog and README
run: git add -f CHANGELOG.md README.md
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v7
with:
commit-message: "CHANGELOG.md: add generated portion."
title: "Release v${{ steps.version-label.outputs.version }}."
body: >
This is an automated PR to prepend the automated changelog
to CHANGELOG.md.<br/>
Please review the changes and adapt them into the changelog proper.
delete-branch: true
labels: release
branch: "release/v${{ steps.version-label.outputs.version }}"