diff --git a/.github/workflows/detect-breaking-changes-levitate.yml b/.github/workflows/detect-breaking-changes-levitate.yml index bb71dc4cfe8..ebb7392dff8 100644 --- a/.github/workflows/detect-breaking-changes-levitate.yml +++ b/.github/workflows/detect-breaking-changes-levitate.yml @@ -234,6 +234,16 @@ jobs: echo "levitate_markdown=No breaking changes detected" >> "$GITHUB_OUTPUT" fi + if [ -f "levitate-mrkdwn.md" ]; then + { + echo 'levitate_mrkdwn<> "$GITHUB_OUTPUT" + else + echo "levitate_mrkdwn=No breaking changes detected" >> "$GITHUB_OUTPUT" + fi + # Comment on the PR - name: Comment on PR @@ -279,7 +289,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "*grafana/grafana* repository has possible breaking changes" + "text": ":warning: *grafana/grafana* has possible breaking changes <${{ github.event.pull_request.html_url }}|#${{ github.event.pull_request.number }}> :warning:" } }, { @@ -287,11 +297,20 @@ jobs: "fields": [ { "type": "mrkdwn", - "text": "*PR:* <${{ github.event.pull_request.html_url }}|#${{ github.event.pull_request.number }}>" + "text": "*Go to PR:* <${{ github.event.pull_request.html_url }}|#${{ github.event.pull_request.number }}>" }, { "type": "mrkdwn", - "text": "*Job:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Job>" + "text": "*Go to Job:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Job>" + } + ] + }, + { + "type": "context", + "elements": [ + { + "type": "mrkdwn", + "text": "${{ steps.levitate-run.outputs.levitate_mrkdwn }}" } ] } diff --git a/packages/grafana-data/src/types/panel.ts b/packages/grafana-data/src/types/panel.ts index 23afeb9b95b..064633e6d0a 100644 --- a/packages/grafana-data/src/types/panel.ts +++ b/packages/grafana-data/src/types/panel.ts @@ -102,9 +102,6 @@ export interface PanelProps { /** @internal */ renderCounter: number; - /** Panel title */ - title: string; - /** Grafana EventBus */ eventBus: EventBus; @@ -154,13 +151,13 @@ export type PanelTypeChangedHandler = ( export type PanelOptionEditorsRegistry = Registry; -export interface PanelOptionsEditorProps extends StandardEditorProps {} +export interface PanelOptionsEditorProps extends StandardEditorProps { } export interface PanelOptionsEditorItem - extends OptionsEditorItem, TValue> {} + extends OptionsEditorItem, TValue> { } export interface PanelOptionsEditorConfig - extends OptionEditorConfig {} + extends OptionEditorConfig { } /** * @internal @@ -358,7 +355,7 @@ export class VisualizationSuggestionsListAppender { constructor( private list: VisualizationSuggestion[], private defaults: VisualizationSuggestion - ) {} + ) { } append(overrides: Partial>) { this.list.push(defaultsDeep(overrides, this.defaults)); diff --git a/scripts/check-breaking-changes.sh b/scripts/check-breaking-changes.sh index d37a6c23669..9053ed17062 100755 --- a/scripts/check-breaking-changes.sh +++ b/scripts/check-breaking-changes.sh @@ -51,12 +51,14 @@ while IFS=" " read -r -a package; do # Record the output, maybe with some additional information STATUS=$? CURRENT_REPORT=$(node ./scripts/levitate-parse-json-report.js) + CURRENT_REPORT_MRKDWN=$(node ./scripts/levitate-parse-json-report-to-mrkdwn.js) # Final exit code # (non-zero if any of the packages failed the checks) if [ "$STATUS" -gt 0 ]; then EXIT_CODE=1 GITHUB_MESSAGE="${GITHUB_MESSAGE}**\\\`${PACKAGE_PATH}\\\`** has possible breaking changes
" GITHUB_LEVITATE_MARKDOWN+="

${PACKAGE_PATH}

${CURRENT_REPORT}
" + GITHUB_LEVITATE_MKRDWN+="##${PACKAGE_PATH}\n${CURRENT_REPORT_MRKDWN}\n" fi done <<<"$PACKAGES" @@ -66,6 +68,7 @@ echo "is_breaking=$EXIT_CODE" >>"$GITHUB_OUTPUT" echo "message=$GITHUB_MESSAGE" >>"$GITHUB_OUTPUT" mkdir -p ./levitate echo "$GITHUB_LEVITATE_MARKDOWN" >./levitate/levitate.md +echo "$GITHUB_LEVITATE_MKRDWN" >./levitate/levitate-mrkdwn.md # We will exit the workflow accordingly at another step exit 0 diff --git a/scripts/levitate-parse-json-report-to-mrkdwn.js b/scripts/levitate-parse-json-report-to-mrkdwn.js new file mode 100644 index 00000000000..cc511c80962 --- /dev/null +++ b/scripts/levitate-parse-json-report-to-mrkdwn.js @@ -0,0 +1,31 @@ +const fs = require('fs'); + +const data = JSON.parse(fs.readFileSync('data.json', 'utf8')); + +function stripAnsi(str) { + return str.replace(/\x1b\[[0-9;]*m/g, ''); +} + +const printSection = (title, items) => { + let output = `#### ${title}\n\n`; + items.forEach((item) => { + const language = item.declaration ? 'typescript' : 'diff'; + const code = item.declaration ? item.declaration : stripAnsi(item.diff); + + output += `**${item.name}**\n\n`; + output += `${item.location}\n\n`; + output += `\`\`\`${language}\n${code}\n\`\`\`\n\n`; + }); + return output; +}; + +let markdown = ''; + +if (data.removals.length > 0) { + markdown += printSection('Removals', data.removals); +} +if (data.changes.length > 0) { + markdown += printSection('Changes', data.changes); +} + +console.log(markdown);