Skip to content

Commit 83270d6

Browse files
🩹 [Patch]: Improve security, update dependencies, and reorganize source files (#19)
This patch modernizes the repository's CI/CD infrastructure by pinning dependencies to specific commits, improving security posture, fixing linter warnings, and aligning the source code structure with PSModule organization standards. - Fixes #18 ## Changed ### Workflow Security Improvements - Pinned all GitHub Actions to commit SHAs with version comments for reproducible builds - Added `persist-credentials: false` to all checkout steps for improved security - Changed Release workflow trigger from `pull_request_target` to `pull_request` for better fork handling - Added path filters to Release workflow to only trigger on relevant file changes (`action.yml`, `src/**`) ### Dependency Management - Updated Dependabot schedule from `weekly` to `daily` with 7-day cooldown for balanced update frequency - Updated `actions/checkout` to `v6.0.2` (SHA: `de0fac2e4500dabe0009e67214ff5f5447ce83dd`) - Updated `super-linter/super-linter` to `v8.3.2` (SHA: `d5b0a2ab116623730dd094f15ddc1b6b25bf7b99`) - Updated `PSModule/GitHub-Script` to `v1.7.10` (SHA: `0097f3bbe3f413f3b577b9bcc600727b0ca3201a`) ### Action Migration - Renamed `Auto-Release.yml` workflow to `Release.yml` - Migrated from `PSModule/Auto-Release@v1` to `PSModule/Release-GHRepository@v2.0.1` (SHA: `88c70461c8f16cc09682005bcf3b7fca4dd8dc1a`) ### Source Reorganization - Moved source files from `scripts/` to `src/` folder for consistency with other PSModule actions - Updated `action.yml` to reference new source path ### Linter Configuration - Removed `.jscpd.json` configuration file - Disabled `VALIDATE_BIOME_FORMAT` and `VALIDATE_JSCPD` validators in super-linter ### Code Quality Fixes - Fixed `PSAvoidUsingWriteHost` warnings by replacing `Write-Host` with `Write-Output` in `main.ps1` ### Action Improvements - Added `Token` input with default value `${{ github.token }}` for automatic authentication - Passed `GITHUB_TOKEN` environment variable to the GitHub-Script action
1 parent e72094e commit 83270d6

File tree

8 files changed

+34
-25
lines changed

8 files changed

+34
-25
lines changed

‎.github/dependabot.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ updates:
1111
- dependencies
1212
- github-actions
1313
schedule:
14-
interval: weekly
14+
interval: daily
15+
cooldown:
16+
default-days: 7

‎.github/linters/.jscpd.json‎

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

‎.github/workflows/Action-Test.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ jobs:
2929
steps:
3030
# Need to check out as part of the test, as its a local action
3131
- name: Checkout repo
32-
uses: actions/checkout@v6
32+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
33+
with:
34+
persist-credentials: false
3335

3436
- name: Action-Test
3537
uses: ./

‎.github/workflows/Linter.yml‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Checkout repo
22-
uses: actions/checkout@v6
22+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2323
with:
2424
fetch-depth: 0
25+
persist-credentials: false
2526

2627
- name: Lint code base
27-
uses: super-linter/super-linter@latest
28+
uses: super-linter/super-linter@d5b0a2ab116623730dd094f15ddc1b6b25bf7b99 # v8.3.2
2829
env:
2930
GITHUB_TOKEN: ${{ github.token }}
31+
VALIDATE_BIOME_FORMAT: false
32+
VALIDATE_JSCPD: false
3033
VALIDATE_JSON_PRETTIER: false
3134
VALIDATE_MARKDOWN_PRETTIER: false
3235
VALIDATE_YAML_PRETTIER: false
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: Auto-Release
1+
name: Release
22

3-
run-name: "Auto-Release - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"
3+
run-name: "Release - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"
44

55
on:
6-
pull_request_target:
6+
pull_request:
77
branches:
88
- main
99
types:
@@ -12,6 +12,9 @@ on:
1212
- reopened
1313
- synchronize
1414
- labeled
15+
paths:
16+
- 'action.yml'
17+
- 'src/**'
1518

1619
concurrency:
1720
group: ${{ github.workflow }}-${{ github.ref }}
@@ -22,13 +25,15 @@ permissions:
2225
pull-requests: write # Required to create comments on the PRs
2326

2427
jobs:
25-
Auto-Release:
28+
Release:
2629
runs-on: ubuntu-latest
2730
steps:
2831
- name: Checkout repo
29-
uses: actions/checkout@v6
32+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
33+
with:
34+
persist-credentials: false
3035

31-
- name: Auto-Release
32-
uses: PSModule/Auto-Release@v1
36+
- name: Release
37+
uses: PSModule/Release-GHRepository@88c70461c8f16cc09682005bcf3b7fca4dd8dc1a # v2.0.1
3338
env:
3439
GITHUB_TOKEN: ${{ github.token }}

‎action.yml‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,19 @@ branding:
66
icon: clipboard
77
color: gray-dark
88

9+
inputs:
10+
Token:
11+
description: The GitHub token to use for authentication.
12+
required: false
13+
default: ${{ github.token }}
14+
915
runs:
1016
using: composite
1117
steps:
1218
- name: Debug
13-
uses: PSModule/GitHub-Script@v1
19+
uses: PSModule/GitHub-Script@0097f3bbe3f413f3b577b9bcc600727b0ca3201a # v1.7.10
1420
env:
21+
GITHUB_TOKEN: ${{ inputs.Token }}
1522
CONTEXT_GITHUB: ${{ toJson(github) }}
1623
CONTEXT_ENV: ${{ toJson(env) }}
1724
# CONTEXT_VARS: ${{ toJson(vars) }}
@@ -28,4 +35,4 @@ runs:
2835
Name: Debug
2936
Script: |
3037
# Debug environment
31-
${{ github.action_path }}/scripts/main.ps1
38+
${{ github.action_path }}/src/main.ps1
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ LogGroup 'Context: [INPUTS]' {
5555
}
5656

5757
LogGroup 'Network Info' {
58-
Write-Host "$(Get-NetIPConfiguration | Out-String)"
58+
Write-Output "$(Get-NetIPConfiguration | Out-String)"
5959
}
6060

6161
LogGroup 'Public IP Info' {
62-
Write-Host "$(Get-PublicIP | Out-String)"
62+
Write-Output "$(Get-PublicIP | Out-String)"
6363
}
6464

6565

0 commit comments

Comments
 (0)