From c13a9e793d1563f0986d6cab1ee8318326969fe4 Mon Sep 17 00:00:00 2001 From: selmankoc Date: Wed, 4 Feb 2026 14:09:37 +0300 Subject: [PATCH 1/3] Add GitHub Actions workflow to automate ABP Studio documentation updates --- .github/workflows/update-studio-docs.yml | 120 +++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 .github/workflows/update-studio-docs.yml diff --git a/.github/workflows/update-studio-docs.yml b/.github/workflows/update-studio-docs.yml new file mode 100644 index 0000000000..ff2f522e20 --- /dev/null +++ b/.github/workflows/update-studio-docs.yml @@ -0,0 +1,120 @@ +name: Update ABP Studio Docs + +on: + repository_dispatch: + types: [update_studio_docs] + +jobs: + update-docs: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - name: Read payload + run: | + echo "Version: ${{ github.event.client_payload.version }}" + echo "Target branch: ${{ github.event.client_payload.target_branch }}" + + - name: Checkout dev + uses: actions/checkout@v4 + with: + ref: dev + fetch-depth: 0 + + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Create working branch + run: | + VERSION="${{ github.event.client_payload.version }}" + BRANCH="docs/studio-${VERSION}" + + git checkout -B "$BRANCH" + echo "BRANCH=$BRANCH" >> $GITHUB_ENV + + # ----------------------------- + # Update release-notes.md + # ----------------------------- + - name: Update release-notes.md + run: | + FILE="docs/en/studio/release-notes.md" + VERSION="${{ github.event.client_payload.version }}" + + mkdir -p docs/en/studio + + if [ ! -f "$FILE" ]; then + echo "# Release Notes" > "$FILE" + echo "" >> "$FILE" + fi + + if grep -q "## Version $VERSION" "$FILE"; then + echo "Version already exists, skipping" + exit 0 + fi + + { + echo "## Version $VERSION" + echo "" + echo "- Documentation updated for ABP Studio $VERSION" + echo "" + echo "---" + echo "" + } > temp.md + + cat temp.md "$FILE" > "$FILE.new" + mv "$FILE.new" "$FILE" + rm temp.md + + # ----------------------------- + # Update version-mapping.md + # ----------------------------- + - name: Update version-mapping.md + run: | + FILE="docs/en/studio/version-mapping.md" + VERSION="${{ github.event.client_payload.version }}" + + mkdir -p docs/en/studio + + if [ ! -f "$FILE" ]; then + echo "| Studio Version | ABP Version |" > "$FILE" + echo "|---------------|-------------|" >> "$FILE" + fi + + if grep -q "| $VERSION |" "$FILE"; then + echo "Mapping already exists, skipping" + exit 0 + fi + + echo "| $VERSION | dev |" >> "$FILE" + + - name: Commit changes + run: | + git add docs/en/studio + git commit -m "docs(studio): update docs for ${{ github.event.client_payload.version }}" + + - name: Push branch + run: | + git push -u origin "$BRANCH" + + - name: Create PR + id: pr + env: + GH_TOKEN: ${{ github.token }} + run: | + PR_URL=$(gh pr create \ + --title "docs(studio): release ${{ github.event.client_payload.version }}" \ + --body "Automated documentation update for ABP Studio ${{ github.event.client_payload.version }}" \ + --base "${{ github.event.client_payload.target_branch }}" \ + --head "$BRANCH") + + echo "PR_URL=$PR_URL" >> $GITHUB_OUTPUT + + - name: Enable auto-merge + env: + GH_TOKEN: ${{ github.token }} + run: | + gh pr merge "$BRANCH" --squash --auto From 1103119c5ef011fd2957493da4a1693eeda3fe2e Mon Sep 17 00:00:00 2001 From: selmankoc Date: Wed, 4 Feb 2026 14:19:15 +0300 Subject: [PATCH 2/3] fix(docs): prevent duplicate entries in release notes and version mapping --- .github/workflows/update-studio-docs.yml | 65 ++++++++++++++---------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/.github/workflows/update-studio-docs.yml b/.github/workflows/update-studio-docs.yml index ff2f522e20..06cbd31562 100644 --- a/.github/workflows/update-studio-docs.yml +++ b/.github/workflows/update-studio-docs.yml @@ -32,7 +32,6 @@ jobs: run: | VERSION="${{ github.event.client_payload.version }}" BRANCH="docs/studio-${VERSION}" - git checkout -B "$BRANCH" echo "BRANCH=$BRANCH" >> $GITHUB_ENV @@ -51,24 +50,23 @@ jobs: echo "" >> "$FILE" fi - if grep -q "## Version $VERSION" "$FILE"; then - echo "Version already exists, skipping" - exit 0 + if ! grep -q "## Version $VERSION" "$FILE"; then + { + echo "## Version $VERSION" + echo "" + echo "- Documentation updated for ABP Studio $VERSION" + echo "" + echo "---" + echo "" + } > temp.md + + cat temp.md "$FILE" > "$FILE.new" + mv "$FILE.new" "$FILE" + rm temp.md + else + echo "Release notes already contain $VERSION, skipping" fi - { - echo "## Version $VERSION" - echo "" - echo "- Documentation updated for ABP Studio $VERSION" - echo "" - echo "---" - echo "" - } > temp.md - - cat temp.md "$FILE" > "$FILE.new" - mv "$FILE.new" "$FILE" - rm temp.md - # ----------------------------- # Update version-mapping.md # ----------------------------- @@ -84,37 +82,48 @@ jobs: echo "|---------------|-------------|" >> "$FILE" fi - if grep -q "| $VERSION |" "$FILE"; then - echo "Mapping already exists, skipping" - exit 0 + if ! grep -q "| $VERSION |" "$FILE"; then + echo "| $VERSION | dev |" >> "$FILE" + else + echo "Version mapping already exists, skipping" fi - echo "| $VERSION | dev |" >> "$FILE" + # ⭐ KRİTİK: değişiklik var mı kontrol et + - name: Check for changes + id: changes + run: | + git add docs/en/studio + if git diff --cached --quiet; then + echo "has_changes=false" >> $GITHUB_OUTPUT + echo "No documentation changes detected" + else + echo "has_changes=true" >> $GITHUB_OUTPUT + fi - name: Commit changes + if: steps.changes.outputs.has_changes == 'true' run: | - git add docs/en/studio git commit -m "docs(studio): update docs for ${{ github.event.client_payload.version }}" - name: Push branch + if: steps.changes.outputs.has_changes == 'true' run: | git push -u origin "$BRANCH" - name: Create PR - id: pr + if: steps.changes.outputs.has_changes == 'true' env: GH_TOKEN: ${{ github.token }} run: | - PR_URL=$(gh pr create \ + gh pr create \ --title "docs(studio): release ${{ github.event.client_payload.version }}" \ --body "Automated documentation update for ABP Studio ${{ github.event.client_payload.version }}" \ --base "${{ github.event.client_payload.target_branch }}" \ - --head "$BRANCH") - - echo "PR_URL=$PR_URL" >> $GITHUB_OUTPUT + --head "$BRANCH" - name: Enable auto-merge + if: steps.changes.outputs.has_changes == 'true' env: - GH_TOKEN: ${{ github.token }} + GH_TOKEN: ${{ secrets.BOT_SECRET }} run: | gh pr merge "$BRANCH" --squash --auto From a2da24aad30f237d8af8faa96a9638c1a668364e Mon Sep 17 00:00:00 2001 From: selmankoc Date: Wed, 4 Feb 2026 14:37:29 +0300 Subject: [PATCH 3/3] refactor(workflow): enhance validation and documentation update process for ABP Studio --- .github/workflows/update-studio-docs.yml | 130 +++++++++++++++++------ 1 file changed, 95 insertions(+), 35 deletions(-) diff --git a/.github/workflows/update-studio-docs.yml b/.github/workflows/update-studio-docs.yml index 06cbd31562..5eefca90c8 100644 --- a/.github/workflows/update-studio-docs.yml +++ b/.github/workflows/update-studio-docs.yml @@ -10,31 +10,87 @@ jobs: permissions: contents: write pull-requests: write + models: read steps: - - name: Read payload + # ----------------------------- + # Validate payload + # ----------------------------- + - name: Validate payload run: | - echo "Version: ${{ github.event.client_payload.version }}" - echo "Target branch: ${{ github.event.client_payload.target_branch }}" + for key in version name notes url target_branch; do + if [ -z "${{ github.event.client_payload[key] }}" ]; then + echo "Missing payload field: $key" + exit 1 + fi + done - - name: Checkout dev - uses: actions/checkout@v4 + # ----------------------------- + # Checkout dev + # ----------------------------- + - uses: actions/checkout@v4 with: ref: dev fetch-depth: 0 - name: Configure git run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" + git config user.name "docs-bot" + git config user.email "docs-bot@users.noreply.github.com" - - name: Create working branch + # ----------------------------- + # Create working branch + # ----------------------------- + - name: Create branch run: | VERSION="${{ github.event.client_payload.version }}" BRANCH="docs/studio-${VERSION}" git checkout -B "$BRANCH" echo "BRANCH=$BRANCH" >> $GITHUB_ENV + # ----------------------------- + # Analyze existing release-notes style + # ----------------------------- + - name: Analyze release notes format + id: format + run: | + FILE="docs/en/studio/release-notes.md" + if [ -f "$FILE" ]; then + head -20 "$FILE" > format.txt + else + echo "## Version X.Y.Z" > format.txt + echo "- Example entry" >> format.txt + fi + echo "FORMAT<> $GITHUB_OUTPUT + cat format.txt >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + # ----------------------------- + # AI: format release notes + # ----------------------------- + - name: Generate release notes with AI + id: ai + uses: actions/ai-inference@v1 + with: + model: openai/gpt-4.1 + prompt: | + You are writing release notes for ABP Studio documentation. + + Existing format example: + ${{ steps.format.outputs.FORMAT }} + + Release info: + Version: ${{ github.event.client_payload.version }} + Name: ${{ github.event.client_payload.name }} + Raw notes: + ${{ github.event.client_payload.notes }} + + Instructions: + - Extract only meaningful user-facing changes + - Use bullet points starting with "- " + - Be concise and professional + - Return ONLY bullet points + # ----------------------------- # Update release-notes.md # ----------------------------- @@ -42,29 +98,25 @@ jobs: run: | FILE="docs/en/studio/release-notes.md" VERSION="${{ github.event.client_payload.version }}" + NAME="${{ github.event.client_payload.name }}" mkdir -p docs/en/studio - - if [ ! -f "$FILE" ]; then - echo "# Release Notes" > "$FILE" - echo "" >> "$FILE" - fi + touch "$FILE" if ! grep -q "## Version $VERSION" "$FILE"; then { - echo "## Version $VERSION" + echo "## Version $VERSION - $NAME" echo "" - echo "- Documentation updated for ABP Studio $VERSION" + echo "${{ steps.ai.outputs.response }}" + echo "" + echo "[Release Link](${{ github.event.client_payload.url }})" echo "" echo "---" echo "" - } > temp.md - - cat temp.md "$FILE" > "$FILE.new" + } | cat - "$FILE" > "$FILE.new" mv "$FILE.new" "$FILE" - rm temp.md else - echo "Release notes already contain $VERSION, skipping" + echo "Release notes already exist" fi # ----------------------------- @@ -76,7 +128,6 @@ jobs: VERSION="${{ github.event.client_payload.version }}" mkdir -p docs/en/studio - if [ ! -f "$FILE" ]; then echo "| Studio Version | ABP Version |" > "$FILE" echo "|---------------|-------------|" >> "$FILE" @@ -84,46 +135,55 @@ jobs: if ! grep -q "| $VERSION |" "$FILE"; then echo "| $VERSION | dev |" >> "$FILE" - else - echo "Version mapping already exists, skipping" fi - # ⭐ KRİTİK: değişiklik var mı kontrol et + # ----------------------------- + # Detect changes + # ----------------------------- - name: Check for changes id: changes run: | git add docs/en/studio if git diff --cached --quiet; then echo "has_changes=false" >> $GITHUB_OUTPUT - echo "No documentation changes detected" else echo "has_changes=true" >> $GITHUB_OUTPUT fi - - name: Commit changes + # ----------------------------- + # Commit & push + # ----------------------------- + - name: Commit & push if: steps.changes.outputs.has_changes == 'true' run: | git commit -m "docs(studio): update docs for ${{ github.event.client_payload.version }}" - - - name: Push branch - if: steps.changes.outputs.has_changes == 'true' - run: | git push -u origin "$BRANCH" + # ----------------------------- + # Create PR + # ----------------------------- - name: Create PR + id: pr if: steps.changes.outputs.has_changes == 'true' env: - GH_TOKEN: ${{ github.token }} + GH_TOKEN: ${{ secrets.BOT_SECRET }} run: | - gh pr create \ + PR_URL=$(gh pr create \ --title "docs(studio): release ${{ github.event.client_payload.version }}" \ - --body "Automated documentation update for ABP Studio ${{ github.event.client_payload.version }}" \ + --body "Automated ABP Studio documentation update." \ --base "${{ github.event.client_payload.target_branch }}" \ - --head "$BRANCH" + --head "$BRANCH") + echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT + # ----------------------------- + # Enable auto-merge (branch protection safe) + # ----------------------------- - name: Enable auto-merge if: steps.changes.outputs.has_changes == 'true' env: GH_TOKEN: ${{ secrets.BOT_SECRET }} run: | - gh pr merge "$BRANCH" --squash --auto + gh pr merge "${{ steps.pr.outputs.pr_url }}" \ + --squash \ + --auto \ + --admin