Skip to content

Commit ea46a19

Browse files
Delete serverless directory on backport PRs (#3916) (#4013)
* 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]>
1 parent 6b458c8 commit ea46a19

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Delete serverless directory in backports
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '7.*'
7+
- '8.*'
8+
9+
jobs:
10+
check-and-delete-serverless:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Check for existence of docs/en/serverless directory
18+
id: check_serverless
19+
run: |
20+
if [ -d "docs/en/serverless" ]; then
21+
echo "SERVERLESS_EXISTS=true" >> $GITHUB_ENV
22+
else
23+
echo "SERVERLESS_EXISTS=false" >> $GITHUB_ENV
24+
fi
25+
26+
- name: Delete docs/en/serverless directory if it exists
27+
if: env.SERVERLESS_EXISTS == 'true'
28+
run: |
29+
rm -rf docs/en/serverless
30+
git config pull.rebase true
31+
git config --global user.name 'github-actions[bot]'
32+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
33+
git add .
34+
git commit -m "Delete docs/en/serverless directory"
35+
git pull origin ${{ github.head_ref }}
36+
git push origin HEAD:${{ github.head_ref }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Pull requests should be tagged with the target version of the Elastic Stack alon
6767
### Elastic Observability Serverless docs
6868
6969
Serverless docs are not versioned, and should never be backported. All changes should be made to the `main` branch.
70+
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.
7071
7172
### Integrations Developer Guide
7273

0 commit comments

Comments
 (0)