Skip to content

Commit dd5f7fd

Browse files
committed
Add info comment to preview build
1 parent 4d27a2d commit dd5f7fd

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

β€Ž.github/workflows/preview-build.ymlβ€Ž

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ on:
5353
type: boolean
5454
default: false
5555
required: false
56+
enabled-info-comment:
57+
description: 'Enable info comment'
58+
type: boolean
59+
default: false
60+
required: false
5661

5762
permissions:
5863
contents: read
@@ -371,6 +376,7 @@ jobs:
371376
ALL_CHANGED_FILES: ${{ needs.check.outputs.all_changed_files }}
372377
PATH_PREFIX: ${{ needs.build.outputs.path_prefix }}
373378
with:
379+
# language=javascript
374380
script: |
375381
const title = '## πŸ” Preview links for changed docs'
376382
const changedMdFiles = process.env.ALL_CHANGED_FILES
@@ -438,3 +444,59 @@ jobs:
438444
body:body.join('\n'),
439445
});
440446
}
447+
- name: Comment on docs changes about versioning requirements
448+
if: inputs.enabled-info-comment == 'true'
449+
uses: actions/github-script@v7
450+
with:
451+
github-token: ${{ secrets.GITHUB_TOKEN }}
452+
# language=javascript
453+
script: |
454+
const pr = context.payload.pull_request;
455+
const prNum = pr.number;
456+
const owner = context.repo.owner;
457+
const repo = context.repo.repo;
458+
459+
460+
const { data: comments } = await github.rest.issues.listComments({
461+
owner, repo, issue_number: prNum
462+
});
463+
464+
const title = '## ℹ️ Important: Docs version tagging';
465+
466+
const existingComment = comments.find(c =>
467+
c.user.type === 'Bot' &&
468+
c.body.startsWith(title)
469+
);
470+
471+
if (existingComment) return;
472+
473+
const body = `${title}
474+
475+
πŸ‘‹ Thanks for updating the docs! Just a friendly reminder that our docs are now **cumulative**. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version.
476+
477+
We use [applies_to tags](https://elastic.github.io/docs-builder/syntax/applies) to mark version-specific features and changes.
478+
479+
<details>
480+
<summary>Expand for a quick overview</summary>
481+
482+
### When to use applies_to tags:
483+
βœ… At the page level to indicate which products/deployments the content applies to (mandatory)
484+
βœ… When features change state (e.g. preview, ga) in a specific version
485+
βœ… When availability differs across deployments and environments
486+
487+
### What NOT to do:
488+
❌ Don't remove or replace information that applies to an older version
489+
❌ Don't add new information that applies to a specific version without an applies_to tag
490+
❌ Don't forget that applies_to tags can be used at the page, section, and inline level
491+
</details>
492+
493+
### πŸ€” Need help?
494+
- Check out the [cumulative docs guidelines](https://elastic.github.io/docs-builder/contribute/cumulative-docs/)
495+
- Reach out in the [#docs](https://elastic.slack.com/archives/C0JF80CJZ) Slack channel`;
496+
497+
await github.rest.issues.createComment({
498+
owner, repo,
499+
issue_number: prNum,
500+
body
501+
});
502+

0 commit comments

Comments
Β (0)