Skip to content

Commit b9c291e

Browse files
authored
Add info comment to preview build (#1667)
* Add info comment to preview build * Rename input
1 parent 492b5c0 commit b9c291e

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

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

Lines changed: 61 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+
enable-cumulative-comment:
57+
description: 'Enable info comment'
58+
type: boolean
59+
default: false
60+
required: false
5661

5762
permissions:
5863
contents: read
@@ -463,6 +468,7 @@ jobs:
463468
ALL_CHANGED_FILES: ${{ needs.check.outputs.all_changed_files }}
464469
PATH_PREFIX: ${{ needs.build.outputs.path_prefix }}
465470
with:
471+
# language=javascript
466472
script: |
467473
const title = '## πŸ” Preview links for changed docs'
468474
const changedMdFiles = process.env.ALL_CHANGED_FILES
@@ -530,3 +536,58 @@ jobs:
530536
body:body.join('\n'),
531537
});
532538
}
539+
- name: Comment on docs changes about versioning requirements
540+
if: inputs.enable-cumulative-comment == 'true'
541+
uses: actions/github-script@v7
542+
with:
543+
github-token: ${{ secrets.GITHUB_TOKEN }}
544+
# language=javascript
545+
script: |
546+
const pr = context.payload.pull_request;
547+
const prNum = pr.number;
548+
const owner = context.repo.owner;
549+
const repo = context.repo.repo;
550+
551+
552+
const { data: comments } = await github.rest.issues.listComments({
553+
owner, repo, issue_number: prNum
554+
});
555+
556+
const title = '## ℹ️ Important: Docs version tagging';
557+
558+
const existingComment = comments.find(c =>
559+
c.user.type === 'Bot' &&
560+
c.body.startsWith(title)
561+
);
562+
563+
if (existingComment) return;
564+
565+
const body = `${title}
566+
567+
πŸ‘‹ 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.
568+
569+
We use [applies_to tags](https://elastic.github.io/docs-builder/syntax/applies) to mark version-specific features and changes.
570+
571+
<details>
572+
<summary>Expand for a quick overview</summary>
573+
574+
### When to use applies_to tags:
575+
βœ… At the page level to indicate which products/deployments the content applies to (mandatory)
576+
βœ… When features change state (e.g. preview, ga) in a specific version
577+
βœ… When availability differs across deployments and environments
578+
579+
### What NOT to do:
580+
❌ Don't remove or replace information that applies to an older version
581+
❌ Don't add new information that applies to a specific version without an applies_to tag
582+
❌ Don't forget that applies_to tags can be used at the page, section, and inline level
583+
</details>
584+
585+
### πŸ€” Need help?
586+
- Check out the [cumulative docs guidelines](https://elastic.github.io/docs-builder/contribute/cumulative-docs/)
587+
- Reach out in the [#docs](https://elastic.slack.com/archives/C0JF80CJZ) Slack channel`;
588+
589+
await github.rest.issues.createComment({
590+
owner, repo,
591+
issue_number: prNum,
592+
body
593+
});

0 commit comments

Comments
Β (0)