ci: Remove inert ADS compliance check (#33603)
The ADS compliance check relies on the condition
`github.pull_request.base.ref == 'true'`, but this variable just doesn't
exist. There's no `pull_request` under the `github` context, so this ADS
compliance check never worked.
If we want this check, we can add it later as part of the
`client-build.compliance.js` script. Here's a PoC for the record, based
on the intention I interpreted:
```javascript
function doADSCheck({core, github, context, affectedFiles}) {
const filesForADSCheck = affectedFiles.filter(f => (f.status === "added" || f.status === "modified") && f.filename.startsWith("app/client/src/"));
const violatedFiles = new Set();
for (const f of filesForADSCheck) {
const content = fs.readFileSync(f.filename, "utf8");
if (content.match(/(color|Color).*#|border.*#|(color|Color).*"/)) {
violatedFiles.add(f.filename);
}
}
if (violatedFiles.size === 0) {
return;
}
const body = [
"🔴 Below files are not compliant with ADS. Please fix and re-trigger ok-to-test",
...Array.from(violatedFiles).sort().map(f => "1. " + f),
].join("\n");
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body,
});
}
```
/test sanity
This commit is contained in:
parent
1d5277c956
commit
35774bb4f6
41
.github/workflows/client-build.yml
vendored
41
.github/workflows/client-build.yml
vendored
|
|
@ -70,6 +70,7 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-tags: true
|
fetch-tags: true
|
||||||
|
|
||||||
- name: Get changed files in the client folder
|
- name: Get changed files in the client folder
|
||||||
id: changed-files-specific
|
id: changed-files-specific
|
||||||
uses: tj-actions/changed-files@v41
|
uses: tj-actions/changed-files@v41
|
||||||
|
|
@ -94,46 +95,6 @@ jobs:
|
||||||
script: |
|
script: |
|
||||||
await require("client-build-compliance.js")({core, github, context})
|
await require("client-build-compliance.js")({core, github, context})
|
||||||
|
|
||||||
- name: Get all the added or changed files in client/src folder
|
|
||||||
if: inputs.ads-compliant-check == 'true' && inputs.pr != 0 && github.pull_request.base.ref == 'release' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
|
|
||||||
id: client_files
|
|
||||||
uses: umani/changed-files@v4.1.0
|
|
||||||
with:
|
|
||||||
repo-token: ${{ secrets.APPSMITH_CI_TEST_PAT }}
|
|
||||||
pattern: "app/client/src/.*"
|
|
||||||
pr-number: ${{ inputs.pr }}
|
|
||||||
|
|
||||||
# Check all the newly added files are in ts
|
|
||||||
- name: ADS compliant check
|
|
||||||
if: inputs.ads-compliant-check == 'true' && inputs.pr != 0 && github.pull_request.base.ref == 'release' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
|
|
||||||
id: ads_check
|
|
||||||
run: |
|
|
||||||
comment_files=""
|
|
||||||
files=(${{steps.client_files.outputs.files_created}}${{steps.client_files.outputs.files_updated}})
|
|
||||||
for file in "${files[@]}"; do
|
|
||||||
while IFS= read -r line; do
|
|
||||||
if echo "$line" | grep -q -E '(color|Color).*#|border.*#|(color|Color).*"'; then
|
|
||||||
comment_files+=("$file")
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done < ${file#app/client/}
|
|
||||||
done
|
|
||||||
unique_files=$(echo "${comment_files[@]}" | sort -u | sed '/^[[:space:]]*$/d' | sed 's/ / <li>/g')
|
|
||||||
echo "ads_non_compliant_files=$unique_files" >> $GITHUB_OUTPUT
|
|
||||||
echo "ads_non_compliant_count=${#unique_files[@]}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
# Comment in PR if test files are not written in ts and fail the workflow
|
|
||||||
- name: Comment in PR if test files are not written in ts
|
|
||||||
if: steps.ads_check.outputs.ads_non_compliant_count != 0 && inputs.ads-compliant-check == 'true' && inputs.pr != 0 && github.pull_request.base.ref == 'release' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
|
|
||||||
uses: peter-evans/create-or-update-comment@v3
|
|
||||||
with:
|
|
||||||
issue-number: ${{ inputs.pr }}
|
|
||||||
body: |
|
|
||||||
<b> 🔴 Below files are not compliant with ADS. Please fix and re-trigger ok-to-test </b>
|
|
||||||
<ol>${{steps.ads_check.outputs.ads_non_compliant_files}}</ol>
|
|
||||||
- if: steps.ads_check.outputs.ads_non_compliant_count != 0 && inputs.ads-compliant-check == 'true' && inputs.pr != 0 && github.pull_request.base.ref == 'release'
|
|
||||||
run: exit 1
|
|
||||||
|
|
||||||
# In case this is second attempt try restoring status of the prior attempt from cache
|
# In case this is second attempt try restoring status of the prior attempt from cache
|
||||||
- name: Restore the previous run result
|
- name: Restore the previous run result
|
||||||
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'
|
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user