From e7e0c88d1175309f8cf107bd483388c195e711d7 Mon Sep 17 00:00:00 2001 From: sabrina lu Date: Tue, 7 Jan 2025 13:17:56 -0500 Subject: [PATCH] Ensure agent 6 RC creation fails if a previous RC PR already exists (#32712) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .github/workflows/create_rc_pr.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/create_rc_pr.yml b/.github/workflows/create_rc_pr.yml index 42a1becd891183..61ab14fa861b1b 100644 --- a/.github/workflows/create_rc_pr.yml +++ b/.github/workflows/create_rc_pr.yml @@ -20,6 +20,26 @@ jobs: branches: ${{ steps.branches.outputs.value }} warning: ${{ steps.warning.outputs.value }} steps: + - name: Check if agent 6 rc PR already exists + if: ${{ env.IS_AGENT6_RELEASE == 'true' }} + run: | + prs=$(gh pr list \ + --repo "$GITHUB_REPOSITORY" \ + --base "$AGENT6_RELEASE_BRANCH" \ + --json url,title \ + --draft=false \ + --search "Update release.json and Go modules for in:title") + + if [ "$(echo "$prs" | jq 'length')" -gt 0 ]; then + pr_list=$(echo "$prs" | jq -r '.[] | "- \(.title): \(.url)"') + error_message="AGENT 6 ERROR: The following Agent 6 release candidate PRs already exist. Please address these PRs before creating a new release candidate:\n$pr_list" + curl -X POST -H 'Content-Type: application/json' \ + --data "{ 'channel_id': 'C0701E5KYSX', 'message': '$error_message' }" \ + ${{ secrets.SLACK_DATADOG_AGENT_CI_WEBHOOK }} + echo -e "\n$error_message" + exit 1 + fi + - name: Checkout repository uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4