From 07f81019b08ea9204bc7ba1aed218a6bfc0ce002 Mon Sep 17 00:00:00 2001 From: Josh Mock Date: Mon, 3 Feb 2025 12:51:15 -0600 Subject: [PATCH] Drop serverless side-port automation --- .github/workflows/serverless-patch.sh | 43 --------------------- .github/workflows/serverless-patch.yml | 53 -------------------------- 2 files changed, 96 deletions(-) delete mode 100755 .github/workflows/serverless-patch.sh delete mode 100644 .github/workflows/serverless-patch.yml diff --git a/.github/workflows/serverless-patch.sh b/.github/workflows/serverless-patch.sh deleted file mode 100755 index a38eda9ec..000000000 --- a/.github/workflows/serverless-patch.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash - -set -exuo pipefail - -merge_commit_sha=$(jq -r '.pull_request.merge_commit_sha' "$GITHUB_EVENT_PATH") -pull_request_id=$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH") -pr_shortcode="elastic/elasticsearch-js#$pull_request_id" - -# generate patch file -cd "$GITHUB_WORKSPACE/stack" -git format-patch -1 --stdout "$merge_commit_sha" > /tmp/patch.diff - -# set committer info -git config --global user.email "elasticmachine@users.noreply.github.com" -git config --global user.name "Elastic Machine" - -# apply patch file -cd "$GITHUB_WORKSPACE/serverless" -git am -C1 --reject /tmp/patch.diff || git am --quit - -# generate PR body comment -comment="Patch applied from $pr_shortcode" - -# enumerate rejected patches in PR comment -has_rejects='false' -for f in ./**/*.rej; do - has_rejects='true' - comment="$comment - -## Rejected patch \`$f\` must be resolved: - -\`\`\`diff -$(cat "$f") -\`\`\` -" -done - -# delete .rej files -rm -fv ./**/*.rej - -# send data to output parameters -echo "$comment" > /tmp/pr_body -echo "PR_DRAFT=$has_rejects" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/serverless-patch.yml b/.github/workflows/serverless-patch.yml deleted file mode 100644 index c83e3ec0e..000000000 --- a/.github/workflows/serverless-patch.yml +++ /dev/null @@ -1,53 +0,0 @@ ---- -name: Apply PR changes to serverless -on: - pull_request_target: - types: - - closed - - labeled - -jobs: - apply-patch: - name: Apply patch - runs-on: ubuntu-latest - # Only react to merged PRs for security reasons. - # See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target. - if: > - github.event.pull_request.merged - && ( - ( - github.event.action == 'closed' - && contains(github.event.pull_request.labels.*.name, 'apply-to-serverless') - ) - || - ( - github.event.action == 'labeled' - && github.event.label.name == 'apply-to-serverless' - ) - ) - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - with: - persist-credentials: false - repository: elastic/elasticsearch-js - ref: main - path: stack - fetch-depth: 0 - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - with: - persist-credentials: false - repository: elastic/elasticsearch-serverless-js - ref: main - path: serverless - - name: Apply patch from stack to serverless - id: apply-patch - run: $GITHUB_WORKSPACE/stack/.github/workflows/serverless-patch.sh - - uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7 - with: - token: ${{ secrets.GH_TOKEN }} - path: serverless - title: "Apply patch from elastic/elasticsearch-js#${{ github.event.pull_request.number }}" - commit-message: "Apply patch from elastic/elasticsearch-js#${{ github.event.pull_request.number }}" - body-path: /tmp/pr_body - draft: "${{ steps.apply-patch.outputs.PR_DRAFT }}" - add-paths: ":!*.rej"