From 5c40bb99ef98399a108d0d6f2a69bcd4693a8bf1 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:00:04 -0400 Subject: [PATCH] Create delete-serverless-dir-in-backports.yml (#5300) (#5306) (cherry picked from commit bd471517a7733104de844f087bc0935ac0ea5dd7) Co-authored-by: Joe Peeples --- .../delete-serverless-dir-in-backports.yml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/delete-serverless-dir-in-backports.yml diff --git a/.github/workflows/delete-serverless-dir-in-backports.yml b/.github/workflows/delete-serverless-dir-in-backports.yml new file mode 100644 index 0000000000..ef25ff2e23 --- /dev/null +++ b/.github/workflows/delete-serverless-dir-in-backports.yml @@ -0,0 +1,35 @@ +name: Delete serverless directory in backports + +on: + pull_request: + branches: + - '7.*' + - '8.*' + +jobs: + check-and-delete-serverless: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Check for existence of docs/serverless directory + id: check_serverless + run: | + if [ -d "docs/serverless" ]; then + echo "SERVERLESS_EXISTS=true" >> $GITHUB_ENV + else + echo "SERVERLESS_EXISTS=false" >> $GITHUB_ENV + fi + - name: Delete docs/serverless directory if it exists + if: env.SERVERLESS_EXISTS == 'true' + run: | + rm -rf docs/serverless + git config pull.rebase true + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add . + git commit -m "Delete docs/serverless directory and its contents" + git pull origin ${{ github.head_ref }} + git push origin HEAD:${{ github.head_ref }}