Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

[Bug]: Coverage report fails silently when PR branch is behind develop

Fermée Adaptée aux débutants
#15,635 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
88/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
git, github-actions, shell
Domaine
ci-cd, devops

Piste de recherche

Commencez par .github/workflows/run_tests_coverage_pr.yml, en particulier l’étape « Get list of changed directories », et comparez-le à .github/workflows/lint_changed_files.yml et .github/workflows/run_affected_tests.yml. Reproduisez le workflow avec une branche de pull request en retard sur develop, puis vérifiez que les répertoires modifiés sont détectés et que le commentaire de coverage contient un tableau plutôt que le message de fallback.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Bug CI
Description

In .github/workflows/run_tests_coverage_pr.yml, the workflow fails to detect changed packages whenever a pull request branch is behind develop. As a result, the PR coverage report comments:

Coverage Report

No coverage information available.

even though the tests run, succeed, and all other CI checks are green.

What Happens:

  1. Shallow Fetch of Base Branch: In .github/workflows/run_tests_coverage_pr.yml (lines 124–127), the step Get list of changed directories executes a shallow fetch (--depth=1).
  2. Divergent History with No Merge Base: Because --depth=1 only fetches the single latest commit on develop, if develop has moved forward since the feature branch was created, git cannot find a common ancestor with HEAD.
  3. Silent Failure via continue-on-error: Because there is no merge base in the shallow history, git diff origin/${{ github.base_ref }}...HEAD fails. Because the step specifies continue-on-error: true, the error does not fail the job. Instead, files and directories evaluate to an empty string "".
  4. Coverage Script Exits Early: The downstream script .github/workflows/scripts/run_tests_coverage/run receives an empty directory list and exits with code 0.
  5. Bot Posts Default Fallback: Because the $TABLE is empty, the stdlib-bot publishes the fallback "No coverage information available." comment instead of the coverage table.

Comparison with Other Workflows:
Other workflows in the repository (such as .github/workflows/lint_changed_files.yml and .github/workflows/run_affected_tests.yml) avoid this issue by computing the common ancestor commit using git merge-base. Because actions/checkout already fetches history (fetch-depth: 1000), the git merge-base calculation works reliably even if the branch is behind develop.

Proposed Fix:
Update the Get list of changed directories step in .github/workflows/run_tests_coverage_pr.yml to use git merge-base, matching the standard used in the linting workflow:

- git fetch origin ${{ github.base_ref }} --depth=1
- files=$(git diff --diff-filter=AM --name-only origin/${{ github.base_ref }}...HEAD)
+ ancestor_commit=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
+ files=$(git diff --diff-filter=AM --name-only $ancestor_commit ${{ github.event.pull_request.head.sha }})
  directories=$(for file in $files; do dirname $file; done | sort -u | tr '\n' ' ' | sed 's/ $//')
  echo "directories=${directories}" >> $GITHUB_OUTPUT
Related Issues

None.

Questions

If the proposed fix looks good, I am happy to open a PR to update the workflow file!

Demo

This bug can be observed in PR #15633.

  • On the initial commit, the feature branch was behind develop, and the coverage action silently failed with the fallback message.
  • Once develop was merged into the PR branch (syncing the history), the coverage table generated successfully, confirming that the missing merge-base was the root cause.
Reproduction
  1. Open a Pull Request where the feature branch is behind develop.
  2. Wait for the run_tests_coverage_pr.yml GitHub Actions workflow to execute.
  3. Observe the Get list of changed directories step silently failing to find changed files.
  4. Observe the stdlib-bot commenting the fallback text: "No coverage information available."
Expected Results

The workflow should correctly identify the changed directories using the merge base (identical to how .github/workflows/lint_changed_files.yml operates) and generate a valid coverage table for the PR.

Actual Results

The workflow silently fails to calculate the git diff due to the shallow fetch, resulting in the bot commenting a useless fallback message on the PR.

Version

develop (Latest)

Environments

N/A

Browser Version

No response

Node.js / npm Version

No response

Platform

Ubuntu (GitHub Actions Runners)

Checklist
  • Read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
Langage dominant
JavaScript
Étoiles
6k
Forks
1.3k
Merge moyen
1 j 9 h
PR mergées (30 j)
595

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de stdlib-js/stdlib

Toutes les issues de stdlib-js/stdlib

Issues similaires

Plus d'issues JavaScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.