Backport of increase default HTTP timeouts for blocking queries and long polling into release/1.22.x #3891
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
| # Copyright (c) HashiCorp, Inc. | |
| # SPDX-License-Identifier: MPL-2.0 | |
| name: Trigger Community Edition to Enterprise Merge | |
| on: | |
| pull_request_target: | |
| types: | |
| - closed | |
| branches: | |
| - main | |
| - release/** | |
| jobs: | |
| trigger-ce-merge: | |
| # run this only on merge events in CE repo | |
| if: ${{ github.event.pull_request.merged && github.repository == 'hashicorp/consul' }} | |
| runs-on: ubuntu-latest | |
| env: | |
| BRANCH: ${{ github.ref_name }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Fetch active releases | |
| id: active | |
| run: | | |
| if [[ "$BRANCH" == "main" ]]; then | |
| IS_ACTIVE=1 | |
| else | |
| IS_ACTIVE=1 | |
| if [[ -f ./.release/versions.hcl ]]; then | |
| ACTIVE=$(awk '/version "[0-9]+\.[0-9]+"/{ver=$2} /ce_active = true/{print ver}' ./.release/versions.hcl | tr -d '"') | |
| echo "Active versions: $ACTIVE" | |
| IS_ACTIVE=0 | |
| for v in $ACTIVE; do | |
| if [[ "$BRANCH" == "release/$v"* ]]; then IS_ACTIVE=1; fi | |
| done | |
| else | |
| echo ".release/versions.hcl not found, defaulting active=1" | |
| fi | |
| fi | |
| echo "active=$IS_ACTIVE" >> $GITHUB_OUTPUT | |
| - name: Get Approving Reviewers | |
| id: reviewers | |
| continue-on-error: true | |
| env: | |
| GH_PAT: ${{ secrets.ELEVATED_GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| REPO: ${{ github.repository }} | |
| run: | | |
| reviewers=$(curl -s -H "Authorization: token $GH_PAT" \ | |
| "https://api.github.com/repos/$REPO/pulls/$PR_NUMBER/reviews" | \ | |
| jq -c '[.[] | select(.state=="APPROVED") | .user.login] | unique') | |
| echo "approved_reviewers=$reviewers" >> $GITHUB_OUTPUT | |
| echo "Approved reviewers: $reviewers" | |
| - name: Trigger Merge | |
| if: steps.active.outputs.active == '1' | |
| env: | |
| GIT_REF: ${{ github.ref_name }} | |
| GIT_SHA: ${{ github.sha }} | |
| GH_PAT: ${{ secrets.ELEVATED_GITHUB_TOKEN }} | |
| GIT_ACTOR: ${{ github.actor }} | |
| PR_TITLE: ${{ github.event.pull_request.title }} | |
| PR_BODY: ${{ github.event.pull_request.body }} | |
| PR_APPROVERS: ${{ steps.reviewers.outputs.approved_reviewers }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| run: | | |
| # Create the JSON payload using jq for safe escaping | |
| payload=$(jq -n \ | |
| --arg event_type "oss-merge" \ | |
| --arg git_ref "$GIT_REF" \ | |
| --arg git_sha "$GIT_SHA" \ | |
| --arg git_actor "$GIT_ACTOR" \ | |
| --arg pr_title "$PR_TITLE" \ | |
| --arg pr_body "$PR_BODY" \ | |
| --argjson pr_approvers "$PR_APPROVERS" \ | |
| --arg pr_number "$PR_NUMBER" \ | |
| '{ | |
| event_type: $event_type, | |
| client_payload: { | |
| "git-ref": $git_ref, | |
| "git-sha": $git_sha, | |
| "git-actor": $git_actor, | |
| "title": $pr_title, | |
| "description": $pr_body, | |
| "pr_approvers": $pr_approvers, | |
| "pr_number": $pr_number | |
| } | |
| }' | |
| ) | |
| curl -v -X POST \ | |
| -H "Authorization: token $GH_PAT" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$payload" \ | |
| "https://api.github.com/repos/hashicorp/consul-enterprise/dispatches" |