Skip to content
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

Implemented action as composite run steps action #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Validate action
on:
push:
pull_request:
schedule:
- cron: 0 0 * * *
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/workflow.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules/
lib
# Visual Studio 2015/2017 cache/options directory
.vs/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This action is intended to configure Pagefile size and location for Windows imag
|----------|-------------|--------|---------------|
| `minimum-size` | Set minimum size of Pagefile | `2048MB`, `4GB`, `8GB` and etc | `8GB` |
| `maximum-size` | Set maximum size of Pagefile | The same like `minimum-size` | `minimum-size` |
| `disk-root` | Set disk root where Pagefile will be located | `C:` or `D:` | `D:` |
| `disk-root` | Set disk root where Pagefile will be located | `C:` or `D:` | `Workspace root` |

# Usage
```
Expand Down
41 changes: 38 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,45 @@ inputs:
disk-root:
description: 'Set disk root where pagefile.sys will be located'
required: false
default: 'D:'
runs:
using: 'node12'
main: 'dist/index.js'
using: 'composite'
steps:
- name: Configure Pagefile
id: configure-pagefile
shell: pwsh
run: |
if ( $PSVersionTable.Platform -ne 'Win32NT') {
throw "This task is intended only for Windows platform. It can't be run on $($PSVersionTable.Platform) platform"
}

[System.UInt64] $MinimumSize = ($env:MinimumSize / 1kb) * 1kb
if ($MinimumSize -le 0) {
$MinimumSize = 8gb
}

[System.UInt64] $MaximumSize = ($env:MaximumSize / 1kb) * 1kb
if ($MaximumSize -le 0) {
$MaximumSize = $MinimumSize
}

[System.String] $DiskRoot = $env:DiskRoot
if ( [System.String]::IsNullOrWhiteSpace($DiskRoot) ) {
$DiskRoot = [System.IO.Path]::GetPathRoot($env:WorkSpace).TrimEnd([System.IO.Path]::DirectorySeparatorChar)
}

echo "Pagefile configuration:"
echo "- Minimum size: $($MinimumSize)"
echo "- Maximum size: $($MaximumSize)"
echo "- Disk root: $($DiskRoot)"

Add-Type -Path "$env:SourcePath"
[Util.PageFile]::SetPageFileSize($MinimumSize, $MaximumSize, $DiskRoot)
env:
MinimumSize: ${{ inputs.minimum-size }}
MaximumSize: ${{ inputs.maximum-size }}
DiskRoot: ${{ inputs.disk-root }}
SourcePath: ${{ github.action_path }}/src/SetPageFileSize.cs
WorkSpace: ${{ github.workspace }}
branding:
icon: 'cpu'
color: 'purple'
Loading