Skip to content

Commit 5395073

Browse files
Initial version (#1)
## Description - Initial version ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [ ] 🪲 [Fix] - [x] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent fe68412 commit 5395073

6 files changed

Lines changed: 107 additions & 90 deletions

File tree

.github/workflows/Action-Test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,3 @@ jobs:
2323

2424
- name: Action-Test
2525
uses: ./
26-
with:
27-
working-directory: ./tests
28-
subject: PSModule

.github/workflows/Auto-Configure.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/Auto-Document.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

action.yml

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1-
name: My Action
2-
description: Action description
1+
name: Debug (by PSModule)
2+
description: |
3+
Print info from the runner environment to logs.
4+
Uses all the contexts and environment variables.
5+
- [Contexts | GitHub Docs](https://docs.github.com/en/actions/learn-github-actions/contexts)
6+
- [Variables] | GitHub Docs](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables)
37
author: PSModule
48
branding:
5-
icon: upload-cloud
6-
color: white
7-
8-
inputs:
9-
working-directory:
10-
description: The working directory where Terraform will be executed
11-
required: false
12-
subject:
13-
description: The subject to greet
14-
required: false
15-
default: World
9+
icon: clipboard
10+
color: gray
1611

1712
runs:
1813
using: composite
1914
steps:
20-
- name: My Action
15+
- name: Debug
2116
shell: pwsh
22-
working-directory: ${{ inputs.working-directory }}
2317
env:
24-
GITHUB_ACTION_INPUT_subject: ${{ inputs.subject }}
18+
CONTEXT_GITHUB: ${{ toJson(github) }}
19+
CONTEXT_ENV: ${{ toJson(env) }}
20+
# CONTEXT_VARS: ${{ toJson(vars) }}
21+
CONTEXT_JOB: ${{ toJson(job) }}
22+
# CONTEXT_JOBS: ${{ toJson(jobs) }}
23+
CONTEXT_STEPS: ${{ toJson(steps) }}
24+
CONTEXT_RUNNER: ${{ toJson(runner) }}
25+
# CONTEXT_SECRETS: ${{ toJson(secrets) }}
26+
CONTEXT_STRATEGY: ${{ toJson(strategy) }}
27+
CONTEXT_MATRIX: ${{ toJson(matrix) }}
28+
# CONTEXT_NEEDS: ${{ toJson(needs) }}
29+
CONTEXT_INPUTS: ${{ toJson(inputs) }}
2530
run: |
26-
$GITHUB_ACTION_PATH/scripts/main.ps1
31+
# Debug environment
32+
. "$env:GITHUB_ACTION_PATH\scripts\main.ps1" -Verbose

scripts/main.ps1

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,84 @@
1-
Write-Host "Hello, $SUBJECT!"
1+
[CmdletBinding()]
2+
param()
3+
4+
$n = [System.Environment]::NewLine
5+
6+
7+
$CONTEXT_GITHUB = $env:CONTEXT_GITHUB | ConvertFrom-Json -Depth 100
8+
'::group::Context: [GITHUB]'
9+
$CONTEXT_GITHUB | ConvertTo-Json -Depth 100
10+
11+
'::group::Context: [GITHUB_EVENT]'
12+
$CONTEXT_GITHUB.event | ConvertTo-Json -Depth 100
13+
14+
'::group::Context: [GITHUB_EVENT_ENTERPRISE]'
15+
$CONTEXT_GITHUB | ConvertTo-Json -Depth 100
16+
17+
'::group::Context: [GITHUB_EVENT_ORGANIZATION]'
18+
$CONTEXT_GITHUB.event.organization | ConvertTo-Json -Depth 100
19+
20+
'::group::Context: [GITHUB_EVENT_REPOSITORY]'
21+
$CONTEXT_GITHUB.event.repository | ConvertTo-Json -Depth 100
22+
23+
'::group::Context: [ENV]'
24+
$env:CONTEXT_ENV
25+
26+
# '::group::Context: [VARS]'
27+
# $env:CONTEXT_VARS
28+
29+
'::group::Context: [JOB]'
30+
$env:CONTEXT_JOB
31+
32+
# '::group::Context: [JOBS]'
33+
# $env:CONTEXT_JOBS
34+
35+
'::group::Context: [STEPS]'
36+
$env:CONTEXT_STEPS
37+
38+
'::group::Context: [RUNNER]'
39+
$env:CONTEXT_RUNNER
40+
41+
# '::group::Context: [SECRETS]'
42+
# $env:CONTEXT_SECRETS
43+
44+
'::group::Context: [STRATEGY]'
45+
$env:CONTEXT_STRATEGY
46+
47+
'::group::Context: [MATRIX]'
48+
$env:CONTEXT_MATRIX
49+
50+
# '::group::Context: [NEEDS]'
51+
# $env:CONTEXT_NEEDS
52+
53+
'::group::Context: [INPUTS]'
54+
$env:CONTEXT_INPUTS
55+
56+
"::group::File system at [$pwd]"
57+
Get-ChildItem -Path . | Select-Object FullName | Sort-Object FullName | Format-Table -AutoSize -Wrap
58+
59+
'::group::Environment Variables'
60+
Get-ChildItem env: | Where-Object {$_.Name -notlike 'CONTEXT_*'} | Sort-Object Name | Format-Table -AutoSize -Wrap
61+
62+
"::group::PowerShell variables"
63+
Get-Variable | Where-Object {$_.Name -notlike 'CONTEXT_*'} | Sort-Object Name | Format-Table -AutoSize -Wrap
64+
65+
"::group::PSVersionTable"
66+
$PSVersionTable | Select-Object *
67+
68+
"::group::ExecutionContext"
69+
$ExecutionContext | Select-Object *
70+
71+
"::group::Host"
72+
$Host | Select-Object *
73+
74+
"::group::MyInvocation"
75+
$MyInvocation | Select-Object *
76+
77+
"::group::PSCmdlet"
78+
$PSCmdlet | Select-Object *
79+
80+
"::group::PSSessionOption"
81+
$PSSessionOption | Select-Object *
82+
83+
"::group::PSStyle"
84+
$PSStyle | Select-Object *

scripts/main.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)