|
| 1 | +name: Auto Review Documentation |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - chienyuanchang/check_description_after_merge # change to main later |
| 7 | + |
| 8 | +permissions: |
| 9 | + id-token: write |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + test-notebooks: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + environment: MMI-Samples |
| 16 | + env: |
| 17 | + AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }} |
| 18 | + AZURE_OPENAI_DEPLOYMENT: ${{ secrets.GPT_4_1_MINI }} |
| 19 | + AZURE_OPENAI_API_VERSION: "2024-12-01-preview" |
| 20 | + GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} |
| 21 | + REPO_NAME: "Azure-Samples/azure-ai-content-understanding-python" |
| 22 | + BRANCH_NAME: "chienyuanchang/check_description_after_merge" # remove later |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Checkout Repo |
| 26 | + uses: actions/checkout@v3 |
| 27 | + |
| 28 | + - name: Set up Python |
| 29 | + uses: actions/setup-python@v4 |
| 30 | + with: |
| 31 | + python-version: '3.12' |
| 32 | + |
| 33 | + - name: Install dependencies |
| 34 | + run: | |
| 35 | + python -m pip install --upgrade pip |
| 36 | + pip install azure-identity python-dotenv PyGithub openai unidiff requests |
| 37 | +
|
| 38 | + - name: Get changed files |
| 39 | + id: changed-docs |
| 40 | + run: | |
| 41 | + git diff --name-only ${{ github.event.before }} ${{ github.sha }} > changed_files.txt |
| 42 | + grep -E '\.md$|\.rst$|README' changed_files.txt || true > changed_docs.txt |
| 43 | + cat changed_docs.txt |
| 44 | +
|
| 45 | + - name: Azure Login |
| 46 | + uses: azure/login@v2 |
| 47 | + with: |
| 48 | + client-id: ${{ secrets.AZURE_CLIENT_ID }} |
| 49 | + tenant-id: ${{ secrets.AZURE_TENANT_ID }} |
| 50 | + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} |
| 51 | + |
| 52 | + - name: Run review script on each file |
| 53 | + run: | |
| 54 | + while read file; do |
| 55 | + if [ -n "$file" ]; then |
| 56 | + echo "Running script with INPUT_FILE_PATH=$file" |
| 57 | + INPUT_FILE_PATH="$file" python tools/review_file/review_file.py |
| 58 | + fi |
| 59 | + done < changed_docs.txt |
0 commit comments