-
Notifications
You must be signed in to change notification settings - Fork 0
🚀[Feature]: Control if GitHub credentials are persisted #50
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
Conversation
Co-authored-by: MariusStorhaug <[email protected]>
Co-authored-by: MariusStorhaug <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new PreserveCredentials
input to let users choose whether GitHub credentials are disconnected after the action runs.
- Added a
PreserveCredentials
input (default'true'
) inaction.yml
- Mapped the new input to an environment variable and updated
scripts/clean.ps1
to conditionally callDisconnect-GitHubAccount
- Updated
README.md
to document the new parameter
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
scripts/clean.ps1 | Added logic to disconnect GitHub contexts/CLI when PreserveCredentials is false |
action.yml | Defined PreserveCredentials input and passed it into the script environment |
README.md | Added PreserveCredentials entry to the inputs table |
Comments suppressed due to low confidence (2)
scripts/clean.ps1:29
- Assigning an environment variable to a boolean literal can lead to type inconsistencies; consider explicitly setting it to the string 'false' to match existing string-based checks and avoid confusion.
$env:PSMODULE_GITHUB_SCRIPT = $false
scripts/clean.ps1:9
- The conditional branch for disconnecting credentials isn't covered by existing tests; consider adding tests for both
PreserveCredentials: 'true'
and'false'
scenarios to validate the cleanup logic.
if (-not $preserveCredentials) {
Add this example to the readme:
|
Co-authored-by: MariusStorhaug <[email protected]>
... Added the example to the README as Example 6 with a descriptive title. Commit: 968f8f0 |
Add a test that sets PersistCredentials to false, and runs a new powershell step after to see if there are any contexts using Get-GitHubContext -ListAvailable. This value should be null. |
Co-authored-by: MariusStorhaug <[email protected]>
Added a test that sets PreserveCredentials to false and verifies credentials are cleaned up using Get-GitHubContext -ListAvailable. The test ensures no contexts remain after cleanup. Commit: 1d4ed59 |
You now have the option to decide if your GitHub credentials should be kept or automatically disconnected after the script finishes. This gives you more flexibility and helps improve security when needed.
How It Works
PreserveCredentials
option tofalse
.Example
Here’s how to disconnect your credentials after running a script:
That’s it! Use this new option if you want to make sure your GitHub connection is cleaned up automatically after your workflow.