Skip to content

Commit c7be7fb

Browse files
committed
Update resources
1 parent 14f4a3b commit c7be7fb

File tree

8 files changed

+155
-178
lines changed

8 files changed

+155
-178
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ body:
1212
description: |-
1313
What the bug is? Add images and/or videos to help for explain this bug if needed.
1414
15-
> **ℹ️ Notice:**
16-
>
15+
> [!NOTE]
1716
> - Should not blur anything in the images and/or videos, except personal secrets.
1817
> - For external images and/or videos, please ensure we are able to view those.
1918
placeholder: |-
@@ -27,8 +26,7 @@ body:
2726
description: |-
2827
Is this bug reproducible? If reproducible, please show the required steps by list, images, and/or videos!
2928
30-
> **ℹ️ Notice:**
31-
>
29+
> [!NOTE]
3230
> - Should not blur anything in the images and/or videos, except personal secrets.
3331
> - For external images and/or videos, please ensure we are able to view those.
3432
placeholder: |-
@@ -55,10 +53,9 @@ body:
5553
description: |-
5654
Which versions are affected by this bug?
5755
58-
> **ℹ️ Notice:**
59-
>
56+
> [!NOTE]
6057
> - Accept versions range.
61-
> - Versions must be listed as supported in the Security Policy (file: `SECURITY.md`).
58+
> - Versions must be listed as supported in the Security Policy (file `SECURITY.md`).
6259
placeholder: |-
6360
1.2.3
6461
validations:
@@ -80,8 +77,7 @@ body:
8077
- **Variables:** Environment variables.
8178
> NO_COLOR=1 / ...
8279
83-
> **ℹ️ Notice:**
84-
>
80+
> [!NOTE]
8581
> - Accept multiple execution environments.
8682
> - All of the properties are optional.
8783
> - It is recommended to provide this information for reproducible steps.

.github/ISSUE_TEMPLATE/documentation-issue.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ body:
2020
description: |-
2121
What the issue is? Add images and/or videos to help for explain this issue if needed.
2222
23-
> **ℹ️ Notice:**
24-
>
23+
> [!NOTE]
2524
> - Should not blur anything in the images and/or videos, except personal secrets.
2625
> - For external images and/or videos, please ensure we are able to view those.
2726
validations:

.github/labels.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
- name: "Platform/Android"
33
color: "#3DDC84"
44
description: "Related to Android."
5-
- name: "Platform/AppleOS"
6-
color: "#000000"
7-
description: "Related to AppleOS."
8-
aliases:
9-
- "Platform/MacOS"
105
- name: "Platform/Bluesky"
116
color: "#0285FF"
127
description: "Related to Bluesky."
@@ -16,6 +11,9 @@
1611
- name: "Platform/ClamAV"
1712
color: "#B83033"
1813
description: "Related to ClamAV."
14+
- name: "Platform/CloudflareWorkers"
15+
color: "#F38020"
16+
description: "Related to Cloudflare Workers."
1917
- name: "Platform/CodeQL"
2018
color: "#FFFFFF"
2119
description: "Related to CodeQL."
@@ -85,6 +83,11 @@
8583
- name: "Platform/LinuxUbuntu"
8684
color: "#E95420"
8785
description: "Related to Linux Ubuntu."
86+
- name: "Platform/MacOS"
87+
color: "#000000"
88+
description: "Related to MacOS."
89+
aliases:
90+
- "Platform/AppleOS"
8891
- name: "Platform/Mastodon"
8992
color: "#6364FF"
9093
description: "Related to Mastodon."
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2-
name: "Publish PowerShell Gallery Module"
2+
name: "Publish PowerShell Module"
33
on:
44
release:
55
types:
@@ -10,9 +10,9 @@ jobs:
1010
name: "Main"
1111
permissions:
1212
contents: "write"
13-
uses: "hugoalh/hugoalh/.github/workflows/call-publish-powershell-gallery-module-0.yml@main"
13+
uses: "hugoalh/hugoalh/.github/workflows/call-publish-powershell-module-0.yml@main"
1414
with:
15-
build: "_build-package.ps1"
16-
path: ".\\hugoalh.GitHubActionsToolkit\\"
15+
builder: "_build-package.ps1"
16+
context: ".\\hugoalh.GitHubActionsToolkit\\"
1717
secrets:
1818
POWERSHELLGALLERY_TOKEN: "${{secrets.POWERSHELLGALLERY_TOKEN}}"

README.md

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,53 @@
11
# GitHub Actions Toolkit (PowerShell)
22

3-
[⚖️ MIT](./LICENSE.md)
3+
[**⚖️** MIT](./LICENSE.md)
44

5-
| | **Release - Latest** | **Release - Pre** |
6-
|:-:|:-:|:-:|
7-
| [![GitHub](https://img.shields.io/badge/GitHub-181717?logo=github&logoColor=ffffff&style=flat-square "GitHub")](https://github.com/hugoalh-studio/ghactions-toolkit-powershell) | ![GitHub Latest Release Version](https://img.shields.io/github/release/hugoalh-studio/ghactions-toolkit-powershell?sort=semver&label=&style=flat-square "GitHub Latest Release Version") (![GitHub Latest Release Date](https://img.shields.io/github/release-date/hugoalh-studio/ghactions-toolkit-powershell?label=&style=flat-square "GitHub Latest Release Date")) | ![GitHub Latest Pre-Release Version](https://img.shields.io/github/release/hugoalh-studio/ghactions-toolkit-powershell?include_prereleases&sort=semver&label=&style=flat-square "GitHub Latest Pre-Release Version") (![GitHub Latest Pre-Release Date](https://img.shields.io/github/release-date-pre/hugoalh-studio/ghactions-toolkit-powershell?label=&style=flat-square "GitHub Latest Pre-Release Date")) |
8-
| [![PowerShell Gallery](https://img.shields.io/badge/PowerShell%20Gallery-0072C6?logo=powershell&logoColor=ffffff&style=flat-square "PowerShell Gallery")](https://www.powershellgallery.com/packages/hugoalh.GitHubActionsToolkit) | ![PowerShell Gallery Latest Release Version](https://img.shields.io/powershellgallery/v/hugoalh.GitHubActionsToolkit?label=&style=flat-square "PowerShell Gallery Latest Release Version") | ![PowerShell Gallery Latest Pre-Release Version](https://img.shields.io/powershellgallery/v/hugoalh.GitHubActionsToolkit?include_prereleases&label=&style=flat-square "PowerShell Gallery Latest Pre-Release Version") |
5+
**🗂️**
6+
[![GitHub: hugoalh-studio/ghactions-toolkit-powershell](https://img.shields.io/badge/hugoalh--studio/ghactions--toolkit--powershell-181717?logo=github&logoColor=ffffff&style=flat "GitHub: hugoalh-studio/ghactions-toolkit-powershell")](https://github.com/hugoalh-studio/ghactions-toolkit-powershell)
7+
[![PowerShell Gallery: hugoalh.GitHubActionsToolkit](https://img.shields.io/badge/hugoalh.GitHubActionsToolkit-0072C6?logo=powershell&logoColor=ffffff&style=flat "PowerShell Gallery: hugoalh.GitHubActionsToolkit")](https://www.powershellgallery.com/packages/hugoalh.GitHubActionsToolkit)
8+
9+
**🆙** ![Latest Release Version](https://img.shields.io/github/release/hugoalh-studio/ghactions-toolkit-powershell?sort=semver&color=2187C0&label=&style=flat "Latest Release Version") (![Latest Release Date](https://img.shields.io/github/release-date/hugoalh-studio/ghactions-toolkit-powershell?color=2187C0&label=&style=flat "Latest Release Date"))
910

1011
A PowerShell module to provide a better and easier way for GitHub Actions to communicate with the runner machine, and the toolkit for developing GitHub Actions in PowerShell.
1112

12-
## 🔰 Begin
13+
## 🎯 Target
1314

14-
### PowerShell
15+
- PowerShell >= v7.2.0
16+
> **💽 Require Software**
17+
>
18+
> - GitHub Actions Runner
19+
> - NodeJS >= v16.13.0 *(Optional, for NodeJS based wrapper API)*
1520
16-
- **Target Version:** >= v7.2.0, &:
17-
- GitHub Actions Runner >= v2.311.0
18-
- NodeJS >= v16.13.0 *\[Optional, for NodeJS based wrapper API\]*
19-
- **Registry:**
20-
- [PowerShell Gallery](https://www.powershellgallery.com/packages/hugoalh.GitHubActionsToolkit)
21-
```ps1
21+
### 🔗 Other Edition
22+
23+
- NodeJS
24+
- [actions/toolkit](https://github.com/actions/toolkit)
25+
- [@actions/artifact](https://www.npmjs.com/package/@actions/artifact)
26+
- [@actions/cache](https://www.npmjs.com/package/@actions/cache)
27+
- [@actions/core](https://www.npmjs.com/package/@actions/core)
28+
- [@actions/exec](https://www.npmjs.com/package/@actions/exec)
29+
- [@actions/github](https://www.npmjs.com/package/@actions/github)
30+
- [@actions/glob](https://www.npmjs.com/package/@actions/glob)
31+
- [@actions/http-client](https://www.npmjs.com/package/@actions/http-client)
32+
- [@actions/io](https://www.npmjs.com/package/@actions/io)
33+
- [@actions/tool-cache](https://www.npmjs.com/package/@actions/tool-cache)
34+
35+
## 🔰 Usage
36+
37+
1. Install via PowerShell:
38+
```pwsh
2239
Install-Module -Name 'hugoalh.GitHubActionsToolkit' -AcceptLicense
2340
```
41+
2. Import at the script (`<ScriptName>.ps1`):
2442
```ps1
2543
Import-Module -Name 'hugoalh.GitHubActionsToolkit' -Scope 'Local'
2644
```
2745
2846
## 🧩 API (Excerpt)
2947
30-
> **ℹ️ Notice:** Documentation is included inside the script file, can view it via:
48+
> **ℹ️ Note**
49+
>
50+
> For the prettier documentation, can visit via:
3151
>
3252
> - [GitHub Repository Wiki](https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki)
3353
@@ -80,23 +100,8 @@ A PowerShell module to provide a better and easier way for GitHub Actions to com
80100
## ✍️ Example
81101
82102
- ```ps1
83-
Import-Module -Name 'hugoalh.GitHubActionsToolkit' -Scope 'Local'
84-
85103
Set-GitHubActionsOutput -Name 'foo' -Value 'bar'
86-
104+
```
105+
- ```ps1
87106
Write-GitHubActionNotice -Message 'Hello, world!'
88107
```
89-
90-
## 🔗 Other Edition
91-
92-
- NodeJS
93-
- [actions/toolkit](https://github.com/actions/toolkit)
94-
- [@actions/artifact](https://www.npmjs.com/package/@actions/artifact)
95-
- [@actions/cache](https://www.npmjs.com/package/@actions/cache)
96-
- [@actions/core](https://www.npmjs.com/package/@actions/core)
97-
- [@actions/exec](https://www.npmjs.com/package/@actions/exec)
98-
- [@actions/github](https://www.npmjs.com/package/@actions/github)
99-
- [@actions/glob](https://www.npmjs.com/package/@actions/glob)
100-
- [@actions/http-client](https://www.npmjs.com/package/@actions/http-client)
101-
- [@actions/io](https://www.npmjs.com/package/@actions/io)
102-
- [@actions/tool-cache](https://www.npmjs.com/package/@actions/tool-cache)

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
| v2.X.X | 🟢 | 2023-12-04 | 2023-12-27 | *Unknown* | >= v2.311.0 | >= v7.2.0 | >= v16.13.0 |
1616
| v1.7.X | 🔴 | 2023-07-24 | 2023-07-24 | 2024-01-01 | >= v2.303.0 | >= v7.2.0 | >= v14.15.0 |
1717

18-
> **ℹ️ Notice:**
18+
> **ℹ️ Note**
1919
>
2020
> - The date format is according to ISO 8601 standard.
2121
> - Values in italic format are subject to change.

hugoalh.GitHubActionsToolkit/lib/nodejs-wrapper.psm1

Lines changed: 23 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#Requires -PSEdition Core -Version 7.2
2-
[SemVer]$RequireVersionMinimum = [SemVer]::Parse('16.13.0')
2+
[SemVer]$NodeJsVersionMinimum = [SemVer]::Parse('16.13.0')
33
[String]$WrapperRoot = Join-Path -Path $PSScriptRoot -ChildPath '..\nodejs-wrapper'
44
[String]$WrapperPackageMetaFilePath = Join-Path -Path $WrapperRoot -ChildPath 'package.json'
55
[String]$WrapperScriptFilePath = Join-Path -Path $WrapperRoot -ChildPath 'main.js'
66
<#
7-
.SYNOPSIS
8-
GitHub Actions - Internal - Invoke NodeJS Wrapper
97
.DESCRIPTION
108
Invoke NodeJS wrapper.
119
.PARAMETER Name
@@ -27,50 +25,37 @@ Function Invoke-NodeJsWrapper {
2725
[Parameter(Mandatory = $True, Position = 1)][Alias('Arguments')][Hashtable]$Argument
2826
)
2927
Try {
30-
$CommandMeta = Get-Command -Name 'node' -CommandType 'Application' -ErrorAction 'SilentlyContinue'
31-
If ($Null -ieq $CommandMeta) {
32-
Throw 'NodeJS is not exist, or not accessible and usable!'
28+
If ($Null -eq (Get-Command -Name 'node' -CommandType 'Application' -ErrorAction 'SilentlyContinue')) {
29+
Throw 'NodeJS is not exist, accessible, or usable!'
3330
}
3431
Try {
35-
[PSCustomObject]$VersionsTable = node --no-deprecation --no-warnings '--eval=console.log(JSON.stringify(process.versions));' *>&1 |
36-
Join-String -Separator "`n" |
37-
ConvertFrom-Json -Depth 100
38-
[SemVer]$CurrentVersion = [SemVer]::Parse($VersionsTable.node)
32+
[SemVer]$NodeJsVersionCurrent = [SemVer]::Parse((
33+
node --no-deprecation --no-warnings '--eval=console.log(process.versions.node);' *>&1 |
34+
Join-String -Separator "`n"
35+
))
3936
}
4037
Catch {
41-
Throw 'NodeJS versions table is not parsable!'
38+
Throw 'unable to get NodeJS version!'
4239
}
43-
If ($RequireVersionMinimum -gt $CurrentVersion) {
44-
Throw 'NodeJS is not fulfill the requirement!'
40+
If ($NodeJsVersionMinimum -gt $NodeJsVersionCurrent) {
41+
Throw "NodeJS version is not fulfill the requirement! Current: $($NodeJsVersionCurrent.ToString()); Expect: >=$($NodeJsVersionMinimum.ToString())"
4542
}
46-
ForEach ($FilePath In @($WrapperPackageMetaFilePath, $WrapperScriptFilePath)) {
47-
If (!(Test-Path -LiteralPath $FilePath -PathType 'Leaf')) {
48-
Throw "wrapper resource `"$FilePath`" is missing!"
49-
}
43+
If (!(Test-Path -LiteralPath $WrapperPackageMetaFilePath -PathType 'Leaf')) {
44+
Throw "NodeJS wrapper package meta file ($WrapperPackageMetaFilePath) is missing!"
5045
}
51-
If ([String]::IsNullOrEmpty($Env:RUNNER_TEMP)) {
52-
Throw 'environment variable `RUNNER_TEMP` is not defined!'
53-
}
54-
If (![System.IO.Path]::IsPathFullyQualified($Env:RUNNER_TEMP)) {
55-
Throw "``$Env:RUNNER_TEMP`` (environment variable ``RUNNER_TEMP``) is not a valid absolute path!"
56-
}
57-
If (!(Test-Path -LiteralPath $Env:RUNNER_TEMP -PathType 'Container')) {
58-
Throw "path ``$Env:RUNNER_TEMP`` is not initialized!"
46+
If (!(Test-Path -LiteralPath $WrapperScriptFilePath -PathType 'Leaf')) {
47+
Throw "NodeJS wrapper script file ($WrapperScriptFilePath) is missing!"
5948
}
6049
}
6150
Catch {
6251
Write-Error -Message "This function depends and requires to invoke with the compatible NodeJS environment, but $_" -Category 'ResourceUnavailable'
6352
Return
6453
}
65-
Do {
66-
[String]$ExchangeFilePath = Join-Path -Path $Env:RUNNER_TEMP -ChildPath ([System.IO.Path]::GetRandomFileName())
67-
}
68-
While (Test-Path -LiteralPath $ExchangeFilePath -PathType 'Leaf')
54+
[String]$ArgumentStringify = $Argument |
55+
ConvertTo-Json -Depth 100 -Compress
56+
[String]$Token = (New-Guid).Guid.ToLower() -ireplace '-', ''
6957
Try {
70-
@{ '$name' = $Name } + $Argument |
71-
ConvertTo-Json -Depth 100 -Compress |
72-
Set-Content -LiteralPath $ExchangeFilePath -Confirm:$False -Encoding 'UTF8NoBOM'
73-
[String]$StdOut = node --no-deprecation --no-warnings $WrapperScriptFilePath $ExchangeFilePath *>&1 |
58+
[String]$StdOut = node --no-deprecation --no-warnings $WrapperScriptFilePath $Name $ArgumentStringify $Token *>&1 |
7459
Where-Object -FilterScript {
7560
If ($_ -imatch '^::.+?::.*$') {
7661
Write-Host -Object $_
@@ -82,22 +67,19 @@ Function Invoke-NodeJsWrapper {
8267
If ($LASTEXITCODE -ne 0) {
8368
Throw "[Exit Code $LASTEXITCODE] $StdOut"
8469
}
85-
[PSCustomObject]$Result = Get-Content -LiteralPath $ExchangeFilePath -Raw -Encoding 'UTF8NoBOM' |
70+
If ($StdOut -inotmatch "(?<=$($Token)\r?\n)(?:.|\r?\n)*?(?=\r?\n$($Token))") {
71+
Throw 'No data return.'
72+
}
73+
[PSCustomObject]$Result = $Matches[0] |
8674
ConvertFrom-Json -Depth 100
8775
If (!$Result.IsSuccess) {
8876
Throw $Result.Reason
8977
}
90-
$Result.Result |
91-
Write-Output
78+
Write-Output -InputObject $Result.Result
9279
}
9380
Catch {
9481
Write-Error -Message "Unable to successfully invoke the NodeJS wrapper ``$Name``: $_" -Category 'InvalidData'
9582
}
96-
Finally {
97-
If (Test-Path -LiteralPath $ExchangeFilePath -PathType 'Leaf') {
98-
Remove-Item -LiteralPath $ExchangeFilePath -Force -Confirm:$False -ErrorAction 'Continue'
99-
}
100-
}
10183
}
10284
Export-ModuleMember -Function @(
10385
'Invoke-NodeJsWrapper'

0 commit comments

Comments
 (0)