docs: review .github/workflows/auto_review_documentation.yml (#61) #6
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: Auto Review Documentation | |
on: | |
push: | |
branches: | |
- chienyuanchang/check_description_after_merge # TODO: change to main | |
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 # Required to compare two SHAs in full history | |
- 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: | | |
# Retrieve list of files changed between the previous commit and the current SHA | |
git diff --name-only ${{ github.event.before }} ${{ github.sha }} > changed_docs.txt | |
# TODO: filter to include only documentation files (e.g., .md, .rst, README, .ipynb) | |
# 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 review script on file: $file" | |
INPUT_FILE_PATH="$file" python tools/review_file/review_file.py | |
fi | |
done < changed_docs.txt |