Describe the bug
the pr-status command has an optional parameter --pr. This command was design to only use the PR number when we don't pass a --sha parameter. Even if we don't pass the --sha and --pr parameters, the command was designed to obtain the sha from the HEAD of the current branch.
The code has a try-catch to prevent auto from throwing an error when the PR number is not available. But this try-catch is not working because the getPrNumber() function calls process.exit(1). The try-catch is not able to stop that.
|
try { |
|
prNumber = this.getPrNumber("pr", pr); |
|
} catch (error) { |
|
// default to sha if no PR found |
|
} |
To Reproduce
Try to create a commit status during the merge_group event (merge queue) (or even the push event). This might be needed when Auto PR Check is a required status check that is set by auto pr-check in the pull_request event. Since it's a required status check, for repos using the merge queue, it also needs to be set during merge_group event (merge queue). In this case, there's no PR number. It should be enough using --sha ${{ github.sha }}.
auto pr-status --url ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} --context "Auto PR Check" --sha ${{ github.sha }} --state success --description "PR labels validated in original PR"
Expected behavior
pr-status should work even if we don't pass the --pr parameter.
Screenshots
Environment information:
ℹ info ENV: {
isCi: true,
name: 'GitHub Actions',
service: 'github',
commit: 'dfd<redacted>f9d',
build: '1<redacted>2',
isPr: false,
branch: 'gh-readonly-queue/main/pr-123-efb<redacted>de6',
prBranch: undefined,
slug: '<redacted>/<redacted>',
root: '/home/<redacted>'
}
Additional context
N/A
Describe the bug
the
pr-statuscommand has an optional parameter--pr. This command was design to only use the PR number when we don't pass a--shaparameter. Even if we don't pass the--shaand--prparameters, the command was designed to obtain theshafrom the HEAD of the current branch.The code has a try-catch to prevent auto from throwing an error when the PR number is not available. But this try-catch is not working because the
getPrNumber()function callsprocess.exit(1). Thetry-catchis not able to stop that.auto/packages/core/src/auto.ts
Line 1831 in 27b93e3
auto/packages/core/src/auto.ts
Lines 955 to 959 in 27b93e3
To Reproduce
Try to create a commit status during the
merge_groupevent (merge queue) (or even thepushevent). This might be needed whenAuto PR Checkis a required status check that is set byauto pr-checkin thepull_requestevent. Since it's a required status check, for repos using the merge queue, it also needs to be set duringmerge_groupevent (merge queue). In this case, there's no PR number. It should be enough using--sha ${{ github.sha }}.Expected behavior
pr-statusshould work even if we don't pass the--prparameter.Screenshots
Environment information:
ℹ info ENV: { isCi: true, name: 'GitHub Actions', service: 'github', commit: 'dfd<redacted>f9d', build: '1<redacted>2', isPr: false, branch: 'gh-readonly-queue/main/pr-123-efb<redacted>de6', prBranch: undefined, slug: '<redacted>/<redacted>', root: '/home/<redacted>' }Additional context
N/A