Skip to content

Commit 12dc22a

Browse files
authored
Merge pull request #10 from csoceanu/update-docs-comment-trigger
Update docs comment trigger
2 parents db117ef + e5be75d commit 12dc22a

9 files changed

Lines changed: 681 additions & 11883 deletions

.github/workflows/codecov.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/gosec.yaml

Lines changed: 0 additions & 49 deletions
This file was deleted.

.github/workflows/pr.yml

Lines changed: 0 additions & 128 deletions
This file was deleted.

.github/workflows/suggest_docs.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Suggest Documentation Update (Enhanced)
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
workflow_dispatch:
7+
inputs:
8+
force_run:
9+
description: 'Force run even if filters would normally skip'
10+
required: false
11+
type: boolean
12+
default: false
13+
14+
permissions:
15+
contents: read
16+
issues: read
17+
pull-requests: read
18+
19+
jobs:
20+
suggest-docs:
21+
runs-on: ubuntu-latest
22+
if: |
23+
github.event.inputs.force_run == 'true' ||
24+
(github.event.issue.pull_request && contains(github.event.comment.body, '[update-docs]'))
25+
26+
steps:
27+
- name: Get PR information
28+
id: pr_info
29+
if: github.event.issue.pull_request
30+
env:
31+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
PR_NUMBER=${{ github.event.issue.number }}
34+
PR_DATA=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER)
35+
echo "head_ref=$(echo "$PR_DATA" | jq -r '.head.ref')" >> $GITHUB_OUTPUT
36+
echo "head_repo=$(echo "$PR_DATA" | jq -r '.head.repo.full_name')" >> $GITHUB_OUTPUT
37+
38+
- name: Checkout PR Code
39+
uses: actions/checkout@v3
40+
with:
41+
repository: ${{ steps.pr_info.outputs.head_repo || github.repository }}
42+
ref: ${{ steps.pr_info.outputs.head_ref || github.ref }}
43+
fetch-depth: 0
44+
token: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Set up Python
47+
uses: actions/setup-python@v4
48+
with:
49+
python-version: '3.10'
50+
51+
- name: Install Python Dependencies
52+
run: |
53+
pip install -U google-genai
54+
55+
- name: Configure Git
56+
run: |
57+
git config --global user.email "docbot@example.com"
58+
git config --global user.name "Doc Bot"
59+
60+
- name: Set up GitHub CLI
61+
run: |
62+
sudo apt-get update
63+
sudo apt-get install -y gh
64+
65+
- name: Run Documentation Suggester
66+
env:
67+
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
68+
DOCS_REPO_URL: ${{ secrets.DOCS_REPO_URL }}
69+
GH_TOKEN: ${{ secrets.GH_PAT }}
70+
run: |
71+
python scripts/suggest_docs.py

0 commit comments

Comments
 (0)