Skip to content

.github/workflows/changelog.yaml #5

.github/workflows/changelog.yaml

.github/workflows/changelog.yaml #5

Workflow file for this run

on:
workflow_dispatch:
inputs:
channel:
description: "Release channel"
required: true
type: choice
options:
- nightly
- stable
workflow_call:
inputs:
channel:
required: true
type: string
issue_number:
required: false
type: number
comment_id:
required: false
type: number
permissions:
id-token: write
contents: write
pull-requests: write
jobs:
generate:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- run: git fetch --tags --force
- if: inputs.comment_id
uses: ./.github/actions/add-reaction
with:
token: ${{ secrets.GITHUB_TOKEN }}
repo: ${{ github.repository }}
comment: ${{ inputs.comment_id }}
reaction: eyes
- uses: ./.github/actions/doxxer_install
- id: version
run: |
if [ "${{ inputs.channel }}" = "nightly" ]; then
VERSION=$(doxxer --config doxxer.desktop.toml next prerelease)
PREV=$(git tag -l 'desktop_v*-nightly.*' --sort=-v:refname | head -n1)
CURRENT="HEAD"
else
VERSION=$(doxxer --config doxxer.desktop.toml next patch)
PREV=$(git tag -l 'desktop_v*' --sort=-v:refname | grep -v 'nightly' | head -n1)
CURRENT=$(git tag -l 'desktop_v*-nightly.*' --sort=-v:refname | head -n1)
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "current=$CURRENT" >> $GITHUB_OUTPUT
echo "prev=$PREV" >> $GITHUB_OUTPUT
- uses: anomalyco/opencode/github@latest
env:
ZAI_API_KEY: ${{ secrets.ZAI_API_KEY }}
with:
model: zai/glm-4.7
use_github_token: true
prompt: |
Create apps/web/content/changelog/${{ steps.version.outputs.version }}.mdx
for commits between ${{ steps.version.outputs.prev }} and ${{ steps.version.outputs.current }}.
Follow apps/web/content/changelog/AGENTS.md.
- uses: peter-evans/create-pull-request@v8
id: cpr
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: changelog/${{ steps.version.outputs.version }}
title: "docs: changelog for ${{ steps.version.outputs.version }}"
body: |
Auto-generated changelog for version ${{ steps.version.outputs.version }}.
Generated using OpenCode based on commits from ${{ steps.version.outputs.prev }} to ${{ steps.version.outputs.current }}.
commit-message: "docs: add changelog for ${{ steps.version.outputs.version }}"
delete-branch: true
- if: inputs.issue_number
uses: ./.github/actions/comment-result
with:
token: ${{ secrets.GITHUB_TOKEN }}
repo: ${{ github.repository }}
issue_number: ${{ inputs.issue_number }}
data: |
[{"header": "Version", "value": "`${{ steps.version.outputs.version }}`"}, {"header": "PR", "value": "${{ steps.cpr.outputs.pull-request-url || 'No changes' }}"}]