diff --git a/.github/workflows/pr-graphql-operations-validation.yaml b/.github/workflows/pr-graphql-operations-validation.yaml index bee3caa..a46c5fe 100644 --- a/.github/workflows/pr-graphql-operations-validation.yaml +++ b/.github/workflows/pr-graphql-operations-validation.yaml @@ -26,8 +26,8 @@ jobs: - name: Install dependencies run: yarn install - - name: Fetch latest PR description - id: pr-body + - name: Extract GraphQL endpoints from PR description + id: endpoints uses: actions/github-script@v7 with: script: | @@ -36,19 +36,16 @@ jobs: repo: context.repo.repo, pull_number: context.payload.pull_request.number, }); - core.setOutput('body', pr.data.body || ''); - - name: Extract GraphQL endpoints from PR description - id: endpoints - run: | - BODY="${{ steps.pr-body.outputs.body }}" - ENDPOINTS=$(echo "$BODY" | grep -iEo 'GraphQL Endpoint:\s*(https?://[^ ]+/graphql)' | sed -E 's/GraphQL Endpoint:\s*//' | paste -sd, -) - if [ -n "$ENDPOINTS" ]; then - echo "Found endpoints in PR: $ENDPOINTS" - echo "endpoints=$ENDPOINTS" >> "$GITHUB_OUTPUT" - else - echo "No endpoints found in PR – will use default or env." - echo "endpoints=" >> "$GITHUB_OUTPUT" - fi + const body = pr.data.body || ''; + const matches = [...body.matchAll(/GraphQL Endpoint:\s*(https?:\/\/[^ ]+\/graphql)/gi)]; + const endpoints = matches.map(m => m[1]).join(','); + if (endpoints) { + core.info(`Found endpoints in PR: ${endpoints}`); + core.setOutput('endpoints', endpoints); + } else { + core.info('No endpoints found in PR – will use default or env.'); + core.setOutput('endpoints', ''); + } - name: Determine final endpoints list id: final-endpoints run: |