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

Feature: Add automatic pr finding #424

Merged
merged 3 commits into from
Sep 30, 2024
Merged

Conversation

davelosert
Copy link
Owner

@davelosert davelosert commented Sep 24, 2024

This pull request introduces a new feature that allows to automatically search for a pull-request in the context of a push event, if the pr-number option is set to `auto.

Documentation Updates:

  • Updated the README.md to explain the new "auto" option for the pr-number parameter, which allows the action to automatically find a matching PR for a given commit SHA.
  • Updated the action.yml to include the new description for the pr-number parameter, explaining the "auto" option for push events.

Test Enhancements:

  • Added test cases in getPullChanges.test.ts to handle RequestError with status codes 404 and 403 gracefully, and to ensure other exceptions are thrown as errors.
  • Enhanced getPullRequestNumber.test.ts with additional test cases to cover various scenarios, including push events with and without the "auto" option, and workflow runs from forks. [1] [2] [3] [4]

Function Modifications:

  • Modified getPullRequestNumber.ts to implement the "auto" option for push events, which attempts to find a PR by matching the commit SHA using the GitHub API. [1] [2] [3]

…th a push-event

Previously, one would have to pass in the concrete PR Number via the `pr-number` option. Now you can set this option 'auto' to automatically find the pull-request associated with the SHA of the cuerrent push-event.
@davelosert davelosert force-pushed the feat-add-automatic-pr-finding branch from 1e8afde to 60a7918 Compare September 24, 2024 18:05
Copy link
Contributor

github-actions bot commented Sep 24, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 70.5%
⬆️ +3.24%
581 / 824
🔵 Statements 70.5%
⬆️ +3.24%
581 / 824
🔵 Functions 87.09%
⬆️ +0.43%
27 / 31
🔵 Branches 95.8%
⬆️ +1.40%
137 / 143
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/inputs/getPullRequestNumber.ts 100% 100% 100% 100%
src/inputs/options.ts 0% 0% 0% 0% 1-2, 5-10, 26, 28, 30-31, 33-36, 38-41, 43-50, 52, 54, 57-60, 62-64, 66, 68-69, 71-72, 74-86
Unchanged Files
src/icons.ts 100% 100% 100% 100%
src/index.ts 0% 0% 0% 0% 1-6, 10-15, 17-18, 23-24, 26-27, 29, 31-36, 38-52, 54-59, 61-70, 72, 74-76, 78-80, 82-84, 86-87, 89-117, 119-143, 145-152, 154-158, 160-166
src/octokit.ts 0% 0% 0% 0% 1-2, 6-9
src/writeSummaryToComment.ts 100% 100% 100% 100%
src/writeSummaryToPR.ts 100% 100% 100% 100%
src/inputs/FileCoverageMode.ts 100% 100% 100% 100%
src/inputs/getCommentOn.ts 100% 100% 100% 100%
src/inputs/getCommitSHA.ts 100% 100% 100% 100%
src/inputs/getPullChanges.ts 100% 92.85% 100% 100%
src/inputs/getViteConfigPath.ts 97.95% 87.5% 100% 97.95% 47
src/inputs/parseCoverageThresholds.ts 100% 100% 100% 100%
src/inputs/parseJsonReports.ts 0% 0% 0% 0% 1-4, 8-14, 16-24, 28-29, 32-34, 36-44, 48-52
src/report/generateCommitSHAUrl.ts 100% 100% 100% 100%
src/report/generateFileCoverageHtml.ts 100% 100% 100% 100%
src/report/generateFileUrl.ts 100% 100% 100% 100%
src/report/generateHeadline.ts 100% 100% 100% 100%
src/report/generateSummaryTableHtml.ts 100% 100% 100% 100%
src/report/getUncoveredLinesFromStatements.ts 100% 100% 100% 100%
Generated in workflow #749 for commit ee2d09a by the Vitest Coverage Report Action

@davelosert davelosert merged commit 001cef1 into main Sep 30, 2024
5 checks passed
@davelosert davelosert deleted the feat-add-automatic-pr-finding branch September 30, 2024 15:59
daves-release-app bot pushed a commit that referenced this pull request Sep 30, 2024
# [2.6.0](v2.5.1...v2.6.0) (2024-09-30)

### Bug Fixes

* **deps-dev:** bump vite from 5.4.3 to 5.4.6 ([#418](#418)) ([a2527f3](a2527f3))
* **deps:** bump rollup from 4.21.2 to 4.22.4 to fix high severity alert ([#422](#422)) ([f8d4182](f8d4182))
* **security:** bump micromatch from 4.0.5 to 4.0.8 to fix low-severity vulnerability ([#407](#407)) ([486156a](486156a))

### Features

* Add option `pr-number: "auto"` to automatically find a pr-number for push-events ([#424](#424)) ([001cef1](001cef1))
* Adds the CommitSHA to the report and fixes CommitSHA gathering in changed file links ([dea95aa](dea95aa))
@daves-release-app
Copy link

🎉 This PR is included in version 2.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant