Skip to content

Commit

Permalink
🩹 [Patch]: Add separate Prerelease test workflow (#32)
Browse files Browse the repository at this point in the history
## Description

This pull request introduces a new workflow for testing prerelease
versions of actions and updates the existing test workflow to support
this new feature.

### New Workflow:

*
[`.github/workflows/Action-Test-Prerelease.yml`](diffhunk://#diff-b5194b0e3305a1cd2a92e3524b1d419f9f3b4ee3d039158dcf12a513a3455953R1-R29):
Added a new workflow named `Action-Test-Prerelease` that runs on
`workflow_dispatch`. It uses the existing `TestWorkflow.yml` with the
`Prerelease` input set to true. This workflow is used for testing
prereleases of the `GitHub` PowerShell module.

### Updates to Existing Workflow

*
[`.github/workflows/TestWorkflow.yml`](diffhunk://#diff-242a265d6d6bfff6094c9285345022d0e6d7ddde58504dfc80249fafbd89ba2cL5-R33):
Added a `Prerelease` input to the `workflow_call` section to allow
running the prerelease version of the action.
*
[`.github/workflows/TestWorkflow.yml`](diffhunk://#diff-242a265d6d6bfff6094c9285345022d0e6d7ddde58504dfc80249fafbd89ba2cR52-R59):
Updated multiple jobs to include the `Prerelease` input, ensuring that
the prerelease version is used during tests. This includes various test
jobs and scripts.
[[1]](diffhunk://#diff-242a265d6d6bfff6094c9285345022d0e6d7ddde58504dfc80249fafbd89ba2cR52-R59)
[[2]](diffhunk://#diff-242a265d6d6bfff6094c9285345022d0e6d7ddde58504dfc80249fafbd89ba2cR86-R128)
[[3]](diffhunk://#diff-242a265d6d6bfff6094c9285345022d0e6d7ddde58504dfc80249fafbd89ba2cL130-R144)
[[4]](diffhunk://#diff-242a265d6d6bfff6094c9285345022d0e6d7ddde58504dfc80249fafbd89ba2cR199)
[[5]](diffhunk://#diff-242a265d6d6bfff6094c9285345022d0e6d7ddde58504dfc80249fafbd89ba2cR217)
[[6]](diffhunk://#diff-242a265d6d6bfff6094c9285345022d0e6d7ddde58504dfc80249fafbd89ba2cR235)
[[7]](diffhunk://#diff-242a265d6d6bfff6094c9285345022d0e6d7ddde58504dfc80249fafbd89ba2cR253)
[[8]](diffhunk://#diff-242a265d6d6bfff6094c9285345022d0e6d7ddde58504dfc80249fafbd89ba2cR272)
[[9]](diffhunk://#diff-242a265d6d6bfff6094c9285345022d0e6d7ddde58504dfc80249fafbd89ba2cR303)

## 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
  • Loading branch information
MariusStorhaug authored Jan 26, 2025
1 parent cdcb935 commit c4b92c6
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 9 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/Action-Test-Prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Action-Test-Prerelease

run-name: "Action-Test - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"

on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: read

jobs:
ActionTest:
uses: ./.github/workflows/TestWorkflow.yml
secrets: inherit
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
with:
runs-on: ${{ matrix.os }}
Prerelease: true
38 changes: 29 additions & 9 deletions .github/workflows/TestWorkflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,35 @@ on:
workflow_call:
inputs:
runs-on:
description: 'The operating system to run the tests on'
description: The operating system to run the tests on
required: true
type: string
Prerelease:
description: Run the prerelease version of the action
required: false
type: boolean
default: false
secrets:
TEST_USER_PAT:
description: 'Personal Access Token for the test user'
description: Personal Access Token for the test user
required: true
TEST_USER_USER_FG_PAT:
description: 'Personal Access Token for the test user with full gists scope'
description: Personal Access Token for the test user with full gists scope
required: true
TEST_USER_ORG_FG_PAT:
description: 'Personal Access Token for the test user with full gists scope'
description: Personal Access Token for the test user with full gists scope
required: true
TEST_APP_ENT_CLIENT_ID:
description: 'Client ID for the test GitHub App for the enterprise'
description: Client ID for the test GitHub App for the enterprise
required: true
TEST_APP_ENT_PRIVATE_KEY:
description: 'Private Key for the test GitHub App for the enterprise'
description: Private Key for the test GitHub App for the enterprise
required: true
TEST_APP_ORG_CLIENT_ID:
description: 'Client ID for the test GitHub App for the organization'
description: Client ID for the test GitHub App for the organization
required: true
TEST_APP_ORG_PRIVATE_KEY:
description: 'Private Key for the test GitHub App for the organization'
description: Private Key for the test GitHub App for the organization
required: true

permissions:
Expand All @@ -44,12 +49,14 @@ jobs:
- name: Action-Test
uses: ./
with:
Prerelease: ${{ inputs.Prerelease }}
Debug: true
Verbose: true

- name: Action-Test [ShowInit]
uses: ./
with:
Prerelease: ${{ inputs.Prerelease }}
Debug: true
Verbose: true
ShowInit: true
Expand All @@ -76,42 +83,49 @@ jobs:
uses: ./
with:
Script: tests/info.ps1
Prerelease: ${{ inputs.Prerelease }}

- name: Action-Test [.\tests\info.ps1]
if: success() || failure()
uses: ./
with:
Script: .\tests\info.ps1
Prerelease: ${{ inputs.Prerelease }}

- name: Action-Test [./tests/info.ps1]
if: success() || failure()
uses: ./
with:
Script: ./tests/info.ps1
Prerelease: ${{ inputs.Prerelease }}

- name: Action-Test [. .\tests\info.ps1]
if: success() || failure()
uses: ./
with:
Script: . .\tests\info.ps1
Prerelease: ${{ inputs.Prerelease }}

- name: Action-Test [. ./tests/info.ps1]
if: success() || failure()
uses: ./
with:
Script: . ./tests/info.ps1
Prerelease: ${{ inputs.Prerelease }}

- name: Action-Test [. '.\tests\info.ps1']
if: success() || failure()
uses: ./
with:
Script: . '.\tests\info.ps1'
Prerelease: ${{ inputs.Prerelease }}

- name: Action-Test [. './tests/info.ps1']
if: success() || failure()
uses: ./
with:
Script: . './tests/info.ps1'
Prerelease: ${{ inputs.Prerelease }}

ActionTestCommands:
name: Commands + Outputs
Expand All @@ -127,7 +141,7 @@ jobs:
with:
Debug: true
Verbose: true
Prerelease: true
Prerelease: ${{ inputs.Prerelease }}
ShowInit: true
ShowOutput: true
Script: |
Expand Down Expand Up @@ -182,6 +196,7 @@ jobs:
uses: ./
with:
Token: ''
Prerelease: ${{ inputs.Prerelease }}
Script: |
LogGroup 'My group' {
'This is a group'
Expand All @@ -199,6 +214,7 @@ jobs:
uses: ./
with:
Token: ${{ secrets.TEST_USER_PAT }}
Prerelease: ${{ inputs.Prerelease }}
Script: |
LogGroup 'Get-GitHubUser' {
Get-GitHubUser | Format-Table -AutoSize
Expand All @@ -216,6 +232,7 @@ jobs:
uses: ./
with:
Token: ${{ secrets.TEST_USER_USER_FG_PAT }}
Prerelease: ${{ inputs.Prerelease }}
Script: |
LogGroup 'Get-GitHubUser' {
Get-GitHubUser | Format-Table -AutoSize
Expand All @@ -233,6 +250,7 @@ jobs:
uses: ./
with:
Token: ${{ secrets.TEST_USER_ORG_FG_PAT }}
Prerelease: ${{ inputs.Prerelease }}
Script: |
LogGroup 'Get-GitHubUser' {
Get-GitHubUser | Format-Table -AutoSize
Expand All @@ -251,6 +269,7 @@ jobs:
with:
ClientID: ${{ secrets.TEST_APP_ENT_CLIENT_ID }}
PrivateKey: ${{ secrets.TEST_APP_ENT_PRIVATE_KEY }}
Prerelease: ${{ inputs.Prerelease }}
Script: |
LogGroup 'Get-GitHubApp' {
Get-GitHubApp | Format-Table -AutoSize
Expand Down Expand Up @@ -281,6 +300,7 @@ jobs:
with:
ClientID: ${{ secrets.TEST_APP_ORG_CLIENT_ID }}
PrivateKey: ${{ secrets.TEST_APP_ORG_PRIVATE_KEY }}
Prerelease: ${{ inputs.Prerelease }}
Script: |
LogGroup 'Get-GitHubApp' {
Get-GitHubApp | Format-Table -AutoSize
Expand Down

0 comments on commit c4b92c6

Please sign in to comment.