Skip to content

Update auto_review_documentation.yml #4

Update auto_review_documentation.yml

Update auto_review_documentation.yml #4

name: Auto Review Documentation
on:
push:
branches:
- chienyuanchang/check_description_after_merge # TODO: change to main later
permissions:
id-token: write
contents: read
jobs:
auto-review-merge:
runs-on: ubuntu-latest
environment: MMI-Samples
env:
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
AZURE_OPENAI_DEPLOYMENT: ${{ secrets.GPT_4_1_MINI }}
AZURE_OPENAI_API_VERSION: "2024-12-01-preview"
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
REPO_NAME: "Azure-Samples/azure-ai-content-understanding-python"
BRANCH_NAME: "chienyuanchang/check_description_after_merge" # TODO: remove later
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Critical for comparing two SHAs
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install azure-identity python-dotenv PyGithub openai unidiff requests
- name: Get changed files
id: changed-docs
run: |
git diff --name-only ${{ github.event.before }} ${{ github.sha }} > changed_docs.txt # changed_files.txt
# TODO: enable for documentation file only
# grep -E '\.md$|\.rst$|README|\.ipynb$' changed_files.txt || true > changed_docs.txt
cat changed_docs.txt
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Run review script on each file
run: |
while read file; do
if [ -n "$file" ]; then
echo "Running script with INPUT_FILE_PATH=$file"
INPUT_FILE_PATH="$file" python tools/review_file/review_file.py
fi
done < changed_docs.txt