Skip to content

Commit

Permalink
Delete serverless directory on backport PRs (#3916) (#4013)
Browse files Browse the repository at this point in the history
* simplified action that produces conflicts

* Update delete-serverless-dir-on-backports.yml

* Update .github/workflows/delete-serverless-dir-on-backports.yml

* Update .github/workflows/delete-serverless-dir-on-backports.yml

* add to readme

(cherry picked from commit 4a57e39)

Co-authored-by: Brandon Morelli <[email protected]>
  • Loading branch information
mergify[bot] and bmorelli25 authored Jun 17, 2024
1 parent 6b458c8 commit ea46a19
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/delete-serverless-dir-on-backports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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/en/serverless directory
id: check_serverless
run: |
if [ -d "docs/en/serverless" ]; then
echo "SERVERLESS_EXISTS=true" >> $GITHUB_ENV
else
echo "SERVERLESS_EXISTS=false" >> $GITHUB_ENV
fi
- name: Delete docs/en/serverless directory if it exists
if: env.SERVERLESS_EXISTS == 'true'
run: |
rm -rf docs/en/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/en/serverless directory"
git pull origin ${{ github.head_ref }}
git push origin HEAD:${{ github.head_ref }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Pull requests should be tagged with the target version of the Elastic Stack alon
### Elastic Observability Serverless docs
Serverless docs are not versioned, and should never be backported. All changes should be made to the `main` branch.
If you're backporting Serverless and Stateful content in the same PR, an automation will run that deletes the `docs/en/serverless` dir from your PR.
### Integrations Developer Guide
Expand Down

0 comments on commit ea46a19

Please sign in to comment.