Skip to content
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

fix: Don't publish comments when no files is update #674

Merged
merged 7 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/actions/comment-pr-with-links/action.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: 'Comments PR with useful links'
description: 'Add a comment to help reviewer on a PR'
name: "Comments PR with useful links"
description: "Add a comment to help reviewer on a PR"

inputs:
site-url:
description: 'The url of preview to check the PR update'
description: "The url of preview to check the PR update"
required: true
component-name:
description: 'The name of the component to build. If set, the build-preview-command input is ignored'
description: "The name of the component to build. If set, the build-preview-command input is ignored"
required: false
default: 'bonita'
default: "bonita"
pattern:
description: ''
description: ""
required: false
default: 'modules/**/*.adoc'
default: "modules/**/*.adoc"
# needed by content repository (default master) and here (computed automagically)
Copy link
Member

@tbouffard tbouffard Feb 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: shouldn't we restrict to modules/**/pages/**/*.adoc to fully fix #534?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to try i think

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine, I am going to open a fake PR in the labs-doc repository.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commited in aaf1a82.
✔️ Tested in bonitasoft/bonita-labs-doc#152 (comment). The previous edit shows that the navbar files was previously listed. This is not the case anymore.

tbouffard marked this conversation as resolved.
Show resolved Hide resolved
doc-site-branch:
description: 'The branch of the `bonita-documentation-site` used to download js files'
description: "The branch of the `bonita-documentation-site` used to download js files"
required: false
default: 'master'
default: "master"

runs:
using: "composite"
Expand Down Expand Up @@ -54,7 +54,7 @@ runs:
uses: actions/checkout@v4
if: ${{ github.event.action != 'closed' }}
with:
repository: 'bonitasoft/bonita-documentation-site'
repository: "bonitasoft/bonita-documentation-site"
ref: ${{ inputs.doc-site-branch }}
path: bds
- name: Compute links to display
Expand All @@ -71,7 +71,7 @@ runs:
const script = require('./bds/.github/actions/comment-pr-with-links/comments-with-url-links.js');
return await script.prepareUrlLinks({github, context});
- name: Create or update comments
if: ${{steps.get-changed-files.outputs.result == 'true' }}
if: ${{steps.get-changed-files.outputs.result == 'true' && (steps.changed-files.outputs.all_changed_files != '' || steps.changed-files.outputs.any_deleted == 'true')}}
uses: actions/github-script@v7
env:
LINKS: ${{steps.set-result.outputs.result}}
Expand Down
1 change: 1 addition & 0 deletions antora-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ antora:
extensions:
- require: ./lib/antora/versions-sorter-extension.js
- require: ./lib/antora/versions-alias-extension.js
- require: ./lib/antora/log-aggregated-component-versions-extension.js
- require: '@antora/atlas-extension'

asciidoc:
Expand Down
21 changes: 21 additions & 0 deletions lib/antora/log-aggregated-component-versions-extension.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Extension to print the component + version that will be processed
// Inspired by https://antora.zulipchat.com/#narrow/stream/282405-tips-.F0.9F.92.A1/topic/Show.20all.20components.20and.20versions.20processed.20when.20building
// And review with content of https://docs.antora.org/antora/latest/extend/extension-use-cases/#list-discovered-component-versions

'use strict'

module.exports.register = function () {
// see https://github.com/pinojs/pino/blob/master/docs/api.md
const logger = this.getLogger('bonita-log-aggregated-component');

this.once('contentAggregated', ({ contentAggregate }) => {
logger.info('Discovered the following component versions')
contentAggregate.forEach((bucket) => {
logger.info(`name: ${bucket.name}, version: ${bucket.version}, files: ${bucket.files.length}`)
if (logger.isLevelEnabled('debug')) {
const sources = bucket.origins.map(({url, refname}) => ({url, refname}));
logger.debug('sources: %o', sources);
}
})
})
}
1 change: 1 addition & 0 deletions lib/antora/versions-alias-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports.register = function () {
const logger = this.getLogger('bonita-version-alias');

this.once('contentClassified', ({ playbook, contentCatalog }) => {
// see https://github.com/pinojs/pino/blob/master/docs/api.md
logger.info('Start version alias computation');

// from https://antora.zulipchat.com/#narrow/stream/282400-users/topic/.E2.9C.94.20Get.20latest.20version.20segment.20in.20template
Expand Down
Loading