chore(docs): add changelog and release notes generation #1
Workflow file for this run
This file contains hidden or 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: Changelog prepare | |
| on: | |
| pull_request: | |
| types: [opened, reopened, synchronize] | |
| paths: | |
| - "CHANGELOG/*.yaml" | |
| jobs: | |
| changelog-prepare: | |
| name: Translate changelog and update release notes | |
| # Secrets and push-back are unavailable for fork PRs; also keeps | |
| # untrusted fork code off the self-hosted runner. | |
| if: github.event.pull_request.head.repo.full_name == github.repository | |
| runs-on: [self-hosted, large] | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout PR branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| token: ${{ secrets.CHANGELOG_PUSH_TOKEN || github.token }} | |
| - name: Translate changelogs missing a .ru.yaml counterpart | |
| env: | |
| GPT_API_TOKEN: ${{ secrets.GPT_API_TOKEN }} | |
| GPT_API_URL: ${{ secrets.GPT_API_URL }} | |
| run: | | |
| for f in CHANGELOG/v*.yaml; do | |
| case "$f" in *.ru.yaml) continue;; esac | |
| ru="${f%.yaml}.ru.yaml" | |
| if [ ! -f "$ru" ]; then | |
| echo "translating $f -> $ru" | |
| hack/chlog.py -o "$ru" translate -f "$f" -l ru | |
| fi | |
| done | |
| - name: Generate release notes | |
| run: | | |
| hack/chlog.py -o docs/RELEASE_NOTES.md release-notes -d CHANGELOG/ -l en | |
| hack/chlog.py -o docs/RELEASE_NOTES.ru.md release-notes -d CHANGELOG/ -l ru | |
| - name: Commit and push changes | |
| env: | |
| HEAD_REF: ${{ github.head_ref }} | |
| run: | | |
| if [ -z "$(git status --porcelain)" ]; then | |
| echo "nothing to commit, translations and release notes are up to date" | |
| exit 0 | |
| fi | |
| git config user.name "ci-changelog" | |
| git config user.email "[email protected]" | |
| git add CHANGELOG/ docs/ | |
| git commit -m "internal(changelog): Add translations and update release notes" | |
| git push origin "HEAD:${HEAD_REF}" |