Skip to content

🩹 [Patch]: Refactor Build-PSModule action without Github-Script #115

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

Merged
merged 4 commits into from
Jun 2, 2025

Conversation

MariusStorhaug
Copy link
Member

@MariusStorhaug MariusStorhaug commented Jun 2, 2025

Description

This pull request includes updates to the PowerShell module build process and related scripts, focusing on improving compatibility with GitHub Actions and simplifying output handling. The changes primarily affect the action.yml file and several PowerShell scripts.

Updates to GitHub Actions configuration:

  • action.yml: Replaced the uses directive for running PowerShell scripts with the shell: pwsh option and updated the run block to execute the build script directly. Simplified artifact upload by changing the path reference to use steps.build.outputs.ModuleOutputFolderPath instead of parsing JSON.

Updates to script handling:

  • scripts/main.ps1: Added a new environment variable $env:GITHUB_REPOSITORY_NAME derived from $env:GITHUB_REPOSITORY for repository name extraction. Replaced Set-GitHubOutput calls with direct appending to $env:GITHUB_OUTPUT for compatibility with GitHub Actions. [1] [2]

Updates to URI generation:

Type of change

  • 📖 [Docs]
  • 🪲 [Fix]
  • 🩹 [Patch]
  • ⚠️ [Security fix]
  • 🚀 [Feature]
  • 🌟 [Breaking change]

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@MariusStorhaug MariusStorhaug self-assigned this Jun 2, 2025
@Copilot Copilot AI review requested due to automatic review settings June 2, 2025 00:14
@MariusStorhaug MariusStorhaug requested a review from a team as a code owner June 2, 2025 00:14
Copy link
Contributor

@Copilot Copilot AI left a 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 refactors the Build-PSModule GitHub Action to drop the GitHub-Script wrapper, invoke the PowerShell build script directly, and simplify output and URI handling.

  • Switches from uses: PSModule/GitHub-Script@v1 to shell: pwsh with a run block in action.yml
  • Updates outputs to use $env:GITHUB_OUTPUT instead of Set-GitHubOutput
  • Simplifies LicenseUri and IconUri generation by using GITHUB_REPOSITORY

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
scripts/main.ps1 Removed Set-GitHubOutput calls and added GITHUB_REPOSITORY_NAME derivation
scripts/helpers/Build/Build-PSModuleManifest.ps1 Changed URI templates to use GITHUB_REPOSITORY directly
action.yml Replaced uses: PSModule/GitHub-Script with shell: pwsh and run block; updated artifact path
Comments suppressed due to low confidence (2)

scripts/main.ps1:23

  • The ModuleName output is no longer written to $env:GITHUB_OUTPUT after removing Set-GitHubOutput. Add a line like "ModuleName=$moduleName" >> $env:GITHUB_OUTPUT to preserve this output.
$sourceFolderPath = Resolve-Path -Path 'src' | Select-Object -ExpandProperty Path

action.yml:47

  • Inputs such as Debug, Prerelease, Verbose, Version, and WorkingDirectory are no longer passed into the script after removing the with block. Ensure these parameters are forwarded (e.g., via env: entries or command-line arguments) so the build script retains full configurability.
run: |

@MariusStorhaug MariusStorhaug merged commit 46d8c8c into main Jun 2, 2025
15 checks passed
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in PSModule Framework Jun 2, 2025
@MariusStorhaug MariusStorhaug deleted the noGitHub branch June 2, 2025 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

1 participant