Skip to content

Commit

Permalink
Create delete-serverless-dir-in-backports.yml (#5300) (#5308)
Browse files Browse the repository at this point in the history
(cherry picked from commit bd47151)

Co-authored-by: Joe Peeples <joe.peeples@elastic.co>
  • Loading branch information
mergify[bot] and joepeeples authored Jun 5, 2024
1 parent a5f4061 commit f19fe4a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/delete-serverless-dir-in-backports.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit f19fe4a

Please sign in to comment.