Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "PowerShell",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/powershell:lts-ubuntu-22.04",

"features": {
"ghcr.io/devcontainers/features/common-utils:2": {},
"ghcr.io/devcontainers/features/sshd:1": {},
Expand All @@ -20,10 +20,10 @@
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"settings": {
"terminal.integrated.defaultProfile.linux": "pwsh"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-vscode.powershell",
Expand All @@ -40,4 +40,3 @@
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}

4 changes: 2 additions & 2 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Disable-ProjectHelperDebug

### GraphQL Integration
1. Store GraphQL in template files: `/public/graphql/queryName.query` or `.mutant`
2. Retrieve via: `Get-GraphQLString "queryName.query"`
2. Retrieve via: `Get-GraphQLString "queryName.query"`
3. Execute: `Invoke-GraphQL -Query $query -Variables $variables`

Example:
Expand Down Expand Up @@ -110,7 +110,7 @@ The folder structure in `Test/` must exactly match the structure in the main mod
- `Test_FindProject_SUCCESS` (success case)
- `Test_AddProjectUser_SUCCESS_SingleUser` (specific variant)
- `Test_GetProjectIssue_NotFound` (error case)
- **Conventions**:
- **Conventions**:
- Use PascalCase matching the actual function name (e.g., `Get-SomeInfo` → `Test_GetSomeInfo_<tip>`)
- `<tip>` should be a descriptive word indicating the test goal (SUCCESS, NotFound, InvalidInput, etc.)
- Use assertions: `Assert-IsTrue`, `Assert-Contains`, `Assert-AreEqual`, `Assert-Count`, `Assert-IsNull`
Expand Down
5 changes: 1 addition & 4 deletions .github/copilot-pull-request-description-instructions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pull Request Code Instructions

## PR TITLE
## PR TITLE

Follow this guidelines to construct the title of your pull request.

Expand Down Expand Up @@ -39,6 +39,3 @@ References:

- Add a summery of the intention of the PR. Use the title and the messages of the commits to create a summary.
- Add a list with all the commit messages in the PR.



11 changes: 5 additions & 6 deletions .github/workflows/deploy_module_on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ jobs:

- name: Run test.ps1
shell: pwsh
run: |
run: |
$result = ./test.ps1 -ShowTestErrors

Write-Output $result

import-module ./tools/Test_Helper/

$passed = Test-Result -Result $result

if($passed)
{ "All test passed" | Write-Verbose -verbose ; exit 0 }
{ "All test passed" | Write-Verbose -verbose ; exit 0 }
else
{ "Not all tests passed" | Write-Verbose -verbose ; exit 1 }

Expand All @@ -42,15 +42,15 @@ jobs:
EVENT_REF: ${{ github.event.ref }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
RELEASE_NAME: ${{ github.event.release.name }}
run: |
run: |

# Import required modules for deployment
import-module ./tools/Test_Helper/

Get-RequiredModule -Verbose | Import-RequiredModule -AllowPrerelease

# GET TAG NAME

## Ref definition. Branch or Tag
$env:EVENT_REF = $env:REF
If ([string]::IsNullOrEmpty($env:EVENT_REF)) {
Expand All @@ -70,4 +70,3 @@ jobs:

# DEPLOYMENT
./deploy.ps1 -VersionTag $tag -NugetApiKey $env:NUGETAPIKEY

11 changes: 5 additions & 6 deletions .github/workflows/powershell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ name: PSScriptAnalyzer
on:
workflow_dispatch:
pull_request:

permissions:
contents: read

Expand All @@ -21,7 +21,7 @@ jobs:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
name: PSScriptAnalyzer
runs-on: ubuntu-latest
steps:
Expand All @@ -33,15 +33,14 @@ jobs:
# Check https://github.com/microsoft/action-psscriptanalyzer for more info about the options.
# The below set up runs PSScriptAnalyzer to your entire repository and runs some basic security rules.
path: .\
recurse: true
recurse: true
severity: 'Error'
# Include your own basic security rules. Removing this option will run all the rules
# Include your own basic security rules. Removing this option will run all the rules
# includeRule: '"PSAvoidGlobalAliases", "PSAvoidUsingConvertToSecureStringWithPlainText"'
output: results.sarif

# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif

9 changes: 4 additions & 5 deletions .github/workflows/test_with_TestingHelper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,16 @@ jobs:
# Runs a single command using the runners shell
- name: Run test.ps1
shell: pwsh
run: |
run: |
$result = ./test.ps1 -ShowTestErrors

Write-Output $result

import-module ./tools/Test_Helper/

$passed = Test-Result -Result $result

if($passed)
{ "All test passed" | Write-Verbose -verbose ; exit 0 }
else
{ "All test passed" | Write-Verbose -verbose ; exit 0 }
else
{ "Not all tests passed" | Write-Verbose -verbose ; exit 1 }

2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
//
// Module V2 - https://raw.githubusercontent.com/rulasg/DemoPsModule/main/.vscode/launch.json

"version": "0.2.0",
"configurations": [
{
Expand Down
10 changes: 5 additions & 5 deletions Notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Notes used during the development of the module
```mermaid
graph TD;



subgraph Module
0([Sync-ProjectItemStaged])
Expand All @@ -33,7 +33,7 @@ graph TD;
H <--> I



```

## Update-ProjectDatabase
Expand All @@ -50,10 +50,10 @@ graph TD;

end
I<-->G


U<-- GitHubOrgProjectWithFields--> I[InvokeHelper]
G <--> H[Invoke-RestMethod]
H <--> Q([GitHub GraphQL API])
```

```
1 change: 0 additions & 1 deletion ProjectHelper.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,3 @@ PrivateData = @{
# DefaultCommandPrefix = ''

}

1 change: 0 additions & 1 deletion ProjectHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ $MODULE_PATH = $PSScriptRoot
catch { Write-Error -Message "Failed to import $($import.fullname): $_" }
}
}

2 changes: 1 addition & 1 deletion Test/helper/module.helper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Find-ModuleRootPath{
$path = $path | Split-Path -Parent
continue
}

# foudn module
return $path
}
Expand Down
6 changes: 3 additions & 3 deletions Test/include/InvokeMockList.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ function readMockCommandFile{

function writeMockCommandFile($Content){

$list = $Content | ConvertTo-Json
$list = $Content | ConvertTo-Json

$sorted = $list | Sort-Object fileName

$sorted | Out-File -FilePath $MockCommandFile
}
5 changes: 2 additions & 3 deletions Test/include/callPrivateContext.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ function Invoke-PrivateContext {
if ([string]::IsNullOrEmpty($ModulePath)) {
$modulePath = $MODULE_PATH | Split-Path -Parent
}

$module = Import-Module -Name $modulePath -PassThru

if ($null -eq $module) {
throw "Failed to import the main module."
}

& $module $ScriptBlock
& $module $ScriptBlock
} Export-ModuleMember -Function Invoke-PrivateContext

6 changes: 3 additions & 3 deletions Test/include/config.mock.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# CONFIG MOCK
# CONFIG MOCK
#
# This file is used to mock the config path and the config file
# for the tests. It creates a mock config path and a mock config file
Expand Down Expand Up @@ -38,8 +38,8 @@ function Mock_Config{

if([string]::IsNullOrWhiteSpace($ModuleName)){
$moduleName = $MODULE_NAME
}
}

$invokefunction = $CONFIG_INVOKE_GET_ROOT_PATH_CMD -replace "ProjectHelper", $moduleName

# Mock invoke call
Expand Down
5 changes: 0 additions & 5 deletions Test/include/invokeCommand.mock.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,3 @@ function Assert-MockFileNotfound{
throw "File not found or wrong case name. Expected[ $filename ] - Found[$( $file.name )]"
}
}





3 changes: 1 addition & 2 deletions Test/include/run_BeforeAfter.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Run Before and After any test
#
#
# Supported by TestingHelper 4.1.0 we can specify code that will run :
# - Before each test
# - After each test
Expand All @@ -25,4 +25,3 @@ function Run_AfterEach{
}

Export-ModuleMember -Function Run_*

5 changes: 2 additions & 3 deletions Test/include/transcriptHelp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function Start-MyTranscript {
}

function Stop-MyTranscript {

$null = Stop-Transcript

$transcriptContent = Get-Content -Path $TEST_TRANSCRIPT_FILE
Expand All @@ -41,7 +41,6 @@ function Export-MyTranscript {
$lastLine = $i[2] - 1

$retlist = $transcriptContent[$firstLine..$lastLine]

return $retlist
}

2 changes: 1 addition & 1 deletion Test/private/MockCall_GitHubUpdateItemValues.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function MockCall_GitHubUpdateItemValues {

$command = 'Import-Module {modulepath} ; ' + $command
$command = $command -replace '{modulepath}', $modulePath
}
}

$command = $command -replace '{ProjectId}', $ProjectId
$command = $command -replace '{ItemId}', $ItemId
Expand Down
18 changes: 9 additions & 9 deletions Test/private/MockCall_Project.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function Get-Mock_Project_625 {

<#
Reset-InvokeCommandMock
Enable-InvokeCommandAliasModule
Enable-InvokeCommandAliasModule
$cmd = 'Invoke-GitHubOrgProjectWithFields -Owner octodemo -ProjectNumber 625 -afterFields "" -afterItems ""'
save-invokeAsMockFile $cmd "invoke-GitHubOrgProjectWithFields-octodemo-625.json"
#>
Expand Down Expand Up @@ -43,7 +43,7 @@ function Get-Mock_Project_625 {
PVTI_lADOAlIw4c4A0Lf4zgfN-44 draft6 2025-03-15 Planned Change to AR as P and Today
PVTI_lADOAlIw4c4A0Lf4zgYNTc0 draft7 2025-03-05 Done Ignore as Done | (Change AR as Past)
PVTI_lADOAlIw4c4A0Lf4zgYNTwo draft8 9999-12-12 In Progress Ignore future
PVTI_lADOAlIw4c4A0Lf4zgfOmpo draft9 9999-12-12 Todo (Ignore not P)
PVTI_lADOAlIw4c4A0Lf4zgfOmpo draft9 9999-12-12 Todo (Ignore not P)
PVTI_lADOAlIw4c4A0Lf4zgfJYv4 Issue for development skip no DueDate
PVTI_lADOAlIw4c4A0Lf4zgfJYvk PullRequest for development skip no DueDate

Expand All @@ -52,7 +52,7 @@ function Get-Mock_Project_625 {
$dateFieldName = "DueDate"
$statusAction = "ActionRequired"
$statusPlanned = "Planned"

$sf = ($content.data.organization.projectV2.fields.nodes | Where-Object { $_.name -eq $statusFieldName })
$df = ($content.data.organization.projectV2.fields.nodes | Where-Object { $_.name -eq $dateFieldName })
$project.updateStatusOnDueDate = @{
Expand All @@ -68,11 +68,11 @@ function Get-Mock_Project_625 {
anyStatus = @{
"PVTI_lADOAlIw4c4A0Lf4zgYNTxI" = @{ $($sf.id) = $statusAction } # draft4
"PVTI_lADOAlIw4c4A0Lf4zgfN77A" = @{ $($sf.id) = $statusAction } # draft9

}
includeDone = @{
"PVTI_lADOAlIw4c4A0Lf4zgYNTc0" = @{ $($df.id) = "" } # draft8

}
includeDoneOther = @{
"PVTI_lADOAlIw4c4A0Lf4zgfN77A" = @{ $($df.id) = "" } # draft5
Expand All @@ -93,7 +93,7 @@ function Get-Mock_Project_625 {
fieldSlug = "sf_"
integrationField = "sfUrl"
fields = @("sf_Int2","sf_Text1")

integrationCommand = "Get-SfAccount"

mockdata1 = @{
Expand Down Expand Up @@ -126,7 +126,7 @@ function Get-Mock_Project_625 {
PVTF_lADOAlIw4c4A0Lf4zg15NMg = "value11"
}

}
}
}

#############################
Expand Down Expand Up @@ -216,7 +216,7 @@ function MockCall_GetProject {
MockCall_GitHubOrgProjectWithFields -Owner $owner -ProjectNumber $projectNumber -FileName $filename -SkipItems:$SkipItems
Mock_Today


if ($Cache) {
$null = Get-Project -Owner $Owner -ProjectNumber $ProjectNumber -SkipItems:$SkipItems
}
Expand Down Expand Up @@ -265,6 +265,6 @@ function Add-ItemsToMock {
title = $draftIssue.content.title
status = ($draftIssue.fieldValues.nodes | Where-Object { $_.field.name -eq "Status" }).name
fieldtext = ($draftIssue.fieldValues.nodes | Where-Object { $_.field.id -eq $($fieldtext.id) }).text

}
}
Loading
Loading