diff --git a/.github/workflows/ado-pipeline-yaml-pr-warning.yml b/.github/workflows/ado-pipeline-yaml-pr-warning.yml new file mode 100644 index 00000000..b095f6f0 --- /dev/null +++ b/.github/workflows/ado-pipeline-yaml-pr-warning.yml @@ -0,0 +1,55 @@ +name: Warn when ADO pipeline YAML file changes + +on: + pull_request: + paths: + - ".azdo/ci-pr.yaml" + +permissions: + contents: read + pull-requests: write + +jobs: + warn: + runs-on: ubuntu-latest + steps: + - name: Emit warning in logs + run: | + echo "::warning file=.azdo/ci-pr.yaml::This PR changes .azdo/ci-pr.yaml. After merge, Azure DevOps may disable/require approval for the PR pipeline YAML until it is re-enabled/approved." + + echo "ADO pipeline: DV-Python-SDK-PullRequest (definitionId=29922)" + echo "https://dev.azure.com/dynamicscrm/OneCRM/_build?definitionId=29922" + + - name: Add workflow summary + run: | + { + echo "## ADO PR pipeline YAML change detected" + echo "" + echo "**File changed:** \`.azdo/ci-pr.yaml\`" + echo "" + echo "**Why this matters:** After this is merged, Azure DevOps may disable/require approval for the PR pipeline YAML." + echo "" + echo "**Action required (post-merge):** Re-enable / approve the updated YAML for:" + echo "- **DV-Python-SDK-PullRequest** (definitionId=29922)" + echo "- https://dev.azure.com/dynamicscrm/OneCRM/_build?definitionId=29922" + echo "" + echo "Then trigger a run to confirm PR validation works." + } >> "$GITHUB_STEP_SUMMARY" + + - name: Post resolvable PR review comment + env: + GH_TOKEN: ${{ github.token }} + run: | + jq -n \ + --arg sha "${{ github.event.pull_request.head.sha }}" \ + '{ + path: ".azdo/ci-pr.yaml", + subject_type: "file", + commit_id: $sha, + body: "> [!WARNING]\n> **ADO PR pipeline YAML change detected**\n>\n> This PR modifies `.azdo/ci-pr.yaml`. After merge, Azure DevOps may disable or require approval for the PR validation pipeline.\n>\n> **Action required (post-merge):** Re-enable / approve the updated YAML for:\n> - **DV-Python-SDK-PullRequest** (definitionId=29922)\n> - https://dev.azure.com/dynamicscrm/OneCRM/_build?definitionId=29922\n>\n> Please resolve this comment after completing the post-merge steps." + }' | \ + gh api \ + --method POST \ + -H "Accept: application/vnd.github+json" \ + /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/comments \ + --input -