-
Notifications
You must be signed in to change notification settings - Fork 27
Add info comment to preview build #1667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -53,6 +53,11 @@ on: | |||||||
type: boolean | ||||||||
default: false | ||||||||
required: false | ||||||||
enable-cumulative-comment: | ||||||||
description: 'Enable info comment' | ||||||||
type: boolean | ||||||||
default: false | ||||||||
required: false | ||||||||
|
||||||||
permissions: | ||||||||
contents: read | ||||||||
|
@@ -371,6 +376,7 @@ jobs: | |||||||
ALL_CHANGED_FILES: ${{ needs.check.outputs.all_changed_files }} | ||||||||
PATH_PREFIX: ${{ needs.build.outputs.path_prefix }} | ||||||||
with: | ||||||||
# language=javascript | ||||||||
script: | | ||||||||
const title = '## 🔍 Preview links for changed docs' | ||||||||
const changedMdFiles = process.env.ALL_CHANGED_FILES | ||||||||
|
@@ -438,3 +444,58 @@ jobs: | |||||||
body:body.join('\n'), | ||||||||
}); | ||||||||
} | ||||||||
- name: Comment on docs changes about versioning requirements | ||||||||
if: inputs.enable-cumulative-comment == 'true' | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
@Mpdreamz I'm sure it's not as simple as that 😆 Had forgotten about this again until I looked at my TODOs, would be nice to get this change in for elasticsearch tho There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The whole job already has the condition to only trigger on changes |
||||||||
uses: actions/github-script@v7 | ||||||||
with: | ||||||||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||||||||
# language=javascript | ||||||||
script: | | ||||||||
const pr = context.payload.pull_request; | ||||||||
const prNum = pr.number; | ||||||||
const owner = context.repo.owner; | ||||||||
const repo = context.repo.repo; | ||||||||
|
||||||||
|
||||||||
const { data: comments } = await github.rest.issues.listComments({ | ||||||||
owner, repo, issue_number: prNum | ||||||||
}); | ||||||||
|
||||||||
const title = '## ℹ️ Important: Docs version tagging'; | ||||||||
|
||||||||
const existingComment = comments.find(c => | ||||||||
c.user.type === 'Bot' && | ||||||||
c.body.startsWith(title) | ||||||||
); | ||||||||
|
||||||||
if (existingComment) return; | ||||||||
|
||||||||
const body = `${title} | ||||||||
|
||||||||
👋 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. | ||||||||
|
||||||||
We use [applies_to tags](https://elastic.github.io/docs-builder/syntax/applies) to mark version-specific features and changes. | ||||||||
|
||||||||
<details> | ||||||||
<summary>Expand for a quick overview</summary> | ||||||||
|
||||||||
### When to use applies_to tags: | ||||||||
✅ At the page level to indicate which products/deployments the content applies to (mandatory) | ||||||||
✅ When features change state (e.g. preview, ga) in a specific version | ||||||||
✅ When availability differs across deployments and environments | ||||||||
|
||||||||
### What NOT to do: | ||||||||
❌ Don't remove or replace information that applies to an older version | ||||||||
❌ Don't add new information that applies to a specific version without an applies_to tag | ||||||||
❌ Don't forget that applies_to tags can be used at the page, section, and inline level | ||||||||
</details> | ||||||||
|
||||||||
### 🤔 Need help? | ||||||||
- Check out the [cumulative docs guidelines](https://elastic.github.io/docs-builder/contribute/cumulative-docs/) | ||||||||
- Reach out in the [#docs](https://elastic.slack.com/archives/C0JF80CJZ) Slack channel`; | ||||||||
|
||||||||
await github.rest.issues.createComment({ | ||||||||
owner, repo, | ||||||||
issue_number: prNum, | ||||||||
body | ||||||||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check for any_modified files in order to not always comment on all PR's even without doc changes if enabled.