Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Require approval for Apple lint tooling changes

Manav Rathi2b8cac6b72e0
diff --git a/.github/checks/change-approval/files.mjs b/.github/checks/change-approval/files.mjs
index 27be282f7d..0b41e304e1 100644
--- a/.github/checks/change-approval/files.mjs
+++ b/.github/checks/change-approval/files.mjs
@@ -5,6 +5,7 @@ const routineBinary = (file) =>
file.includes("Assets.xcassets/");
const guardrailDirs = [
".github/",
+ "apple/scripts/",
"mobile/checks/",
"mobile/scripts/",
"rust/checks/",
@@ -15,6 +16,9 @@ const guardrailDirs = [
"web/packages/build-config/",
];
const guardrailFiles = new Set([
+ "apple/Package.swift",
+ ".swift-format",
+ ".swiftlint.yml",
"eslint.config.mjs",
".prettierrc.json",
"analysis_options.yaml",
@@ -37,6 +41,7 @@ export function checkFiles({ files }) {
({ path, added }) =>
!added &&
(guardrailDirs.some((dir) => path.startsWith(dir)) ||
+ guardrailFiles.has(path) ||
guardrailFiles.has(basename(path))),
),
...files.filter(
diff --git a/.github/checks/change-approval/test.mjs b/.github/checks/change-approval/test.mjs
index 2f41276885..4b088eb5f4 100644
--- a/.github/checks/change-approval/test.mjs
+++ b/.github/checks/change-approval/test.mjs
@@ -595,6 +595,10 @@ test("existing guardrails modified or deleted", (t) => {
{
".github/scripts/x.mjs": "",
".github/workflows/x.yml": "on: push\n",
+ "apple/.swift-format": "{}\n",
+ "apple/.swiftlint.yml": "only_rules: []\n",
+ "apple/Package.swift": "// swift-tools-version: 6.0\n",
+ "apple/scripts/lint.sh": "swift format lint --strict\n",
"mobile/checks/x/check.rb": "",
"rust/checks/x/check.py": "",
"web/apps/x/eslint.config.mjs": "",
@@ -603,6 +607,10 @@ test("existing guardrails modified or deleted", (t) => {
{
".github/scripts/x.mjs": "export {};\n",
".github/workflows/x.yml": "on: pull_request\n",
+ "apple/.swift-format": null,
+ "apple/.swiftlint.yml": "only_rules: [empty_count]\n",
+ "apple/Package.swift": "// swift-tools-version: 6.1\n",
+ "apple/scripts/lint.sh": "swift format lint\n",
"mobile/checks/x/check.rb": "\n",
"rust/checks/x/check.py": "\n",
"web/apps/x/eslint.config.mjs": null,
@@ -612,7 +620,7 @@ test("existing guardrails modified or deleted", (t) => {
);
assert.equal(
output,
- "6 guardrail files\n\n## Guardrail changes\n\n- `.github/scripts/x.mjs`\n- `.github/workflows/x.yml`\n- `mobile/checks/x/check.rb`\n- `rust/checks/x/check.py`\n- `web/apps/x/eslint.config.mjs`\n- `web/checks/x/check.mjs`\n\n",
+ "10 guardrail files\n\n## Guardrail changes\n\n- `.github/scripts/x.mjs`\n- `.github/workflows/x.yml`\n- `apple/.swift-format`\n- `apple/.swiftlint.yml`\n- `apple/Package.swift`\n- `apple/scripts/lint.sh`\n- `mobile/checks/x/check.rb`\n- `rust/checks/x/check.py`\n- `web/apps/x/eslint.config.mjs`\n- `web/checks/x/check.mjs`\n\n",
);
});