fix: Fix for GHES to allow variations in GitHub Actions bot user id #222
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several changes across the codebase to improve handling of GitHub Actions bot information, refactor constants, enhance test coverage, and ensure asynchronous handling of functions. The most significant updates include replacing hardcoded bot email and ID with dynamic retrieval from the GitHub API, refactoring constants for clarity, and converting several functions to asynchronous operations.
GitHub Actions Bot Information Updates:
src/utils/github.ts
: Added a new functiongetGitHubActionsBotEmail
to dynamically retrieve the GitHub Actions bot email address using the GitHub API. This replaces hardcoded values for better adaptability across environments.src/releases.ts
andsrc/wiki.ts
: Updated Git configuration commands to use the dynamically retrieved bot email instead of the hardcodedGITHUB_ACTIONS_BOT_EMAIL
. [1] [2]Constants Refactoring:
src/utils/constants.ts
: RemovedGITHUB_ACTIONS_BOT_USER_ID
andGITHUB_ACTIONS_BOT_EMAIL
, replacing them withGITHUB_ACTIONS_BOT_USERNAME
for consistency and clarity.Test Enhancements:
__tests__/helpers/octokit.ts
: Added support for mocking theusers.getByUsername
endpoint to facilitate testing of the new dynamic bot email retrieval functionality. [1] [2] [3]__tests__/utils/github.test.ts
: Added new tests to validate the behavior of thegetGitHubActionsBotEmail
function using real API queries.Asynchronous Function Updates:
src/wiki.ts
,src/releases.ts
, andsrc/main.ts
: ConvertedcommitAndPushWikiChanges
and related calls to asynchronous functions for improved reliability and error handling. [1] [2]Simplification of Release Comment Logic:
src/pull-request.ts
: Simplified thehasReleaseComment
function by removing the check forGITHUB_ACTIONS_BOT_USER_ID
, allowing the function to focus solely on the presence of the release marker.