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(ci): ignore deleted file in log-url-isuses script #35776

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

OnkarRuikar
Copy link
Contributor

Summary

When a file is deleted then the log-url-issues script throws following error:

Error: ENOENT: no such file or directory, open '/home/runner/work/content/content/files/en-us/web/http/basics_of_http/index.md'
    at Object.openSync (node:fs:596:3)
    at Object.readFileSync (node:fs:464:35)
    at getFileContent (file:///home/runner/work/content/content/scripts/log-url-issues.js:30:22)
    at getFileAnchors (file:///home/runner/work/content/content/scripts/log-url-issues.js:39:19)
    at file:///home/runner/work/content/content/scripts/log-url-issues.js:126:33
    at Array.filter (<anonymous>)
    at getFragmentDetails (file:///home/runner/work/content/content/scripts/log-url-issues.js:124:10)
    at file:///home/runner/work/content/content/scripts/log-url-issues.js:[15](https://github.com/mdn/content/actions/runs/10739132976/job/29784189803?pr=35774#step:4:16)0:3
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:337:24) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/home/runner/work/content/content/files/en-us/web/http/basics_of_http/index.md'

Problem

While fixing #35577, we started reading files containing the header to check for duplicate headers. So, it throws an error when trying to read the deleted file to check if duplicate headers with the same names exist.

Solution

If a file is deleted don't try to check duplicate headers in it.

@OnkarRuikar OnkarRuikar requested a review from a team as a code owner September 6, 2024 15:33
@OnkarRuikar OnkarRuikar requested review from bsmth and removed request for a team September 6, 2024 15:33
@github-actions github-actions bot added system [PR only] Infrastructure and configuration for the project size/s [PR only] 6-50 LoC changed labels Sep 6, 2024
@Josh-Cena Josh-Cena merged commit dd91930 into mdn:main Sep 6, 2024
6 of 7 checks passed
@OnkarRuikar OnkarRuikar deleted the ci_url_issues branch September 6, 2024 15:38
);
const absPath = `${rootDir}/files/en-us/${path}/index.md`;
if (!fs.existsSync(absPath)) {
return true;
Copy link
Member

Choose a reason for hiding this comment

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

nice, tnx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/s [PR only] 6-50 LoC changed system [PR only] Infrastructure and configuration for the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants