[8.12] Create delete-serverless-dir-in-backports.yml (backport #5300) #5308
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves https://github.com/elastic/security-docs-internal/issues/18. Adds a GitHub action to keep serverless files from getting backported into versioned branches (for example,
7.17
or8.15
).Why do this?
We don't want to add version-less serverless source files into versioned branches (
7.x
and8.x
), which could happen with backports of PRs containing changes to both serverless and classic/stateful. The only place where serverless source files should exist is inmain
.How it works
7.*
or8.*
. The action doesn’t run for PRs targeting any other branches, such asmain
.docs/serverless
subdirectory within the PR’s working branch.Previews and testing
This was kinda difficult to test without first merging the workflow YAML and then testing it "live." But I did manage to test and validate that this works as expected. Expand the section below for more details.
The biggest testing takeaway was that we'll need to backport the workflow YAML file to all the previous branches where we want it to run. Just having the action in
main
isn't enough, because backport PRs don't targetmain
. That makes total sense, but I didn't realize it until halfway through the tests.Expand for gory details
First I tested in a very simple private repo, but I didn't feel super confident about that because it was too simple to be realistic. It also wasn't in a good shareable state, so others couldn't verify my work or refer back to it if needed.
Next I tested in my personal fork of
security-docs
. I created a few versioned 8.x and 7.x branches, added the YAML, and then opened some PRs to confirm that the action triggered and ran as expected (or didn't run when not expected to do so). Everything looks good!This is an automatic backport of pull request #5300 done by [Mergify](https://mergify.com).