Skip to content

Commit dfa850b

Browse files
authored
Allow to update extensions even if they don't comply every rule (#1757)
- Don't show in changelog
1 parent 9198f9a commit dfa850b

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

.github/workflows/commands.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
env:
4646
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4747
run: |
48-
gh pr comment ${{ github.event.issue.number }} --body "A build error occured while merging:
48+
gh pr comment ${{ github.event.issue.number }} --body "A build error occurred while merging:
4949
5050
\`\`\`${{ env.BUILD_LOGS }}
5151
\`\`\`"
@@ -96,7 +96,7 @@ jobs:
9696
shell: bash
9797

9898
- name: Commit and push
99-
if: ${{ steps.git-diff.outputs.changed == 'true' && contains(env.BUILD_LOGS, 'successfully updated') }}
99+
if: ${{ steps.git-diff.outputs.changed == 'true' && contains(env.BUILD_LOGS, 'No fatal error found') }}
100100
run: |
101101
git add extensions
102102
git commit -m "Updated extension"
@@ -114,8 +114,18 @@ jobs:
114114
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115115
run: gh pr comment ${{ github.event.issue.number }} --body "✅ Successfully updated the extension."
116116

117-
- name: Notify build error
118-
if: ${{ steps.git-diff.outputs.changed == 'true' && !contains(env.BUILD_LOGS, 'successfully updated') }}
117+
- name: Notify non-fatal build error
118+
if: ${{ steps.git-diff.outputs.changed == 'true' && contains(env.BUILD_LOGS, 'No fatal error found') }}
119+
env:
120+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
run: |
122+
gh pr comment ${{ github.event.issue.number }} --body "Extension updated with errors:
123+
124+
\`\`\`${{ env.BUILD_LOGS }}
125+
\`\`\`"
126+
127+
- name: Notify fatal build error
128+
if: ${{ steps.git-diff.outputs.changed == 'true' && !contains(env.BUILD_LOGS, 'successfully updated') && !contains(env.BUILD_LOGS, 'No fatal error found') }}
119129
env:
120130
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121131
run: |

scripts/generate-extensions-registry.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,13 @@ const filterEventsFunctions = (eventsFunctions) =>
285285
const objectShortHeaders = [];
286286

287287
let totalErrors = 0;
288+
let fatalErrors = 0;
288289
let fixableErrors = 0;
289290

290291
const errors = validateNoDuplicates(allExtensionWithFileInfos);
291292
errors.forEach((error) => {
292293
totalErrors++;
294+
fatalErrors++;
293295
shell.echo(`❌ ${error.message}`);
294296
});
295297

@@ -301,6 +303,7 @@ const filterEventsFunctions = (eventsFunctions) =>
301303
`\n❌ Unable to open extension in file ${extensionWithFileInfo.filename}: ${error.message}\n`
302304
);
303305
totalErrors++;
306+
fatalErrors++;
304307
return;
305308
}
306309

@@ -482,7 +485,9 @@ const filterEventsFunctions = (eventsFunctions) =>
482485
fixableErrors > 1 ? 's are' : ' is'
483486
} auto-fixable - pass the argument --fix to fix them automatically.`
484487
);
485-
shell.exit(args['disable-exit-code'] ? 0 : 1);
488+
if (fatalErrors) {
489+
shell.exit(args['disable-exit-code'] ? 0 : 1);
490+
}
486491
}
487492

488493
const views = JSON.parse(
@@ -524,7 +529,13 @@ const filterEventsFunctions = (eventsFunctions) =>
524529
registry
525530
);
526531

527-
console.log(`✅ Headers and registry files successfully updated`);
532+
if (totalErrors) {
533+
console.log(
534+
`No fatal error found the extension can be updated but still need fixes.`
535+
);
536+
} else {
537+
console.log(`✅ Headers and registry files successfully updated`);
538+
}
528539
} catch (error) {
529540
console.error(
530541
`⚠️ Error while generating headers and registry files:`,

scripts/lib/rules/JavascriptDisallowedProperties.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ async function validate({ extension, onError }) {
138138
accumulator +
139139
inspect(current, undefined, undefined, process.env.CI !== 'true') +
140140
'\n',
141-
`Found disallowed properties in extension '${extension.name}':\n`
141+
`JavaScript usage of the extension '${extension.name}' must be checked by the reviewer:\n`
142142
)
143143
// Remove the last \n
144144
.slice(0, -1);

0 commit comments

Comments
 (0)