From 6ac0157995e83b9711a7f52066cbdb5f12ca9477 Mon Sep 17 00:00:00 2001 From: Tristan Labelle Date: Tue, 10 Jun 2025 10:05:35 -0400 Subject: [PATCH] Expand inputs through environment variables --- action.yml | 17 +++++++++++++---- start/action.yml | 6 +++++- stop/action.yml | 5 +++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index 2aa2408..1666355 100644 --- a/action.yml +++ b/action.yml @@ -23,29 +23,38 @@ runs: - name: Install Dashcam GUI (Windows) if: ${{ runner.os == 'Windows' }} shell: pwsh + env: + DASHCAM_VERSION: ${{ inputs.version }} run: | $env:PATH = "$env:GITHUB_ACTION_PATH\src\windows;$env:PATH" Write-Host "Installing Dashcam GUI on ${{ runner.os }}" - Install-DashcamGUI.ps1 -Version ${{ inputs.version }} + Install-DashcamGUI.ps1 -Version $env:DASHCAM_VERSION - name: Install Node.js for Dashcam CLI (Windows) if: ${{ runner.os == 'Windows' }} shell: pwsh + env: + NODE_VERSION: ${{ inputs.node-version }} + NODE_DIRECTORY: ${{ inputs.node-directory }} + NODE_PREFIX: ${{ inputs.node-prefix }} run: | Write-Host "Installing Node.js for Dashcam CLI on ${{ runner.os }}" $env:PATH = "$env:GITHUB_ACTION_PATH\src\windows;$env:PATH" - Install-NodeJS.ps1 -Version ${{ inputs.node-version }} -Directory ${{ inputs.node-directory }} -Prefix ${{ inputs.node-prefix }} + Install-NodeJS.ps1 -Version $env:NODE_VERSION -Directory $env:NODE_DIRECTORY -Prefix $env:NODE_PREFIX - name: Install Dashcam CLI (Windows) if: ${{ runner.os == 'Windows' }} shell: pwsh + env: + NODE_DIRECTORY: ${{ inputs.node-directory }} + NODE_PREFIX: ${{ inputs.node-prefix }} run: | Write-Host "Installing Dashcam CLI on ${{ runner.os }}" - $env:PATH = "$env:GITHUB_ACTION_PATH\src\windows;${{ inputs.node-directory }};${{ inputs.node-prefix }};$env:PATH" + $env:PATH = "$env:GITHUB_ACTION_PATH\src\windows;$env:NODE_DIRECTORY;$env:NODE_PREFIX;$env:PATH" Install-DashcamCLI.ps1 - Add-Content -Path $env:GITHUB_ENV -Encoding utf8 -Value "DASHCAM_NODE_DIR=${{ inputs.node-directory }}" + Add-Content -Path $env:GITHUB_ENV -Encoding utf8 -Value "DASHCAM_NODE_DIR=$env:NODE_DIRECTORY" - name: Install Dashcam GUI (macOS) if: ${{ runner.os == 'macOS' }} diff --git a/start/action.yml b/start/action.yml index 2515989..dd798a0 100644 --- a/start/action.yml +++ b/start/action.yml @@ -18,6 +18,10 @@ runs: steps: - name: Start Recording shell: pwsh + env: + API_KEY: ${{ inputs.api-key }} + LOG_FILE_PATHS: ${{ inputs.log-file-paths }} + CONNECTION_TIMEOUT: ${{ inputs.connection-timeout }} run: | $env:PATH = "$env:GITHUB_ACTION_PATH\src\windows;$env:PATH" Write-Host "Starting recording with Dashcam API key: ${{ inputs.api-key }}" @@ -28,7 +32,7 @@ runs: Write-Host "PWD: $env:PWD" Get-ChildItem -Path $env:GITHUB_ACTION_PATH\src\windows Get-Command Dashcam-Start.ps1 - Dashcam-Start.ps1 -ApiKey "${{ inputs.api-key }}" -LogFilePaths "${{ inputs.log-file-paths }}" -Timeout "${{ inputs.connection-timeout }}" + Dashcam-Start.ps1 -ApiKey $env:API_KEY -LogFilePaths $env:LOG_FILE_PATHS -Timeout $env:CONNECTION_TIMEOUT branding: icon: "video" diff --git a/stop/action.yml b/stop/action.yml index 7f8b59d..32242a3 100644 --- a/stop/action.yml +++ b/stop/action.yml @@ -11,8 +11,9 @@ runs: steps: - name: Stop Recording shell: pwsh + env: + PROJECT_ID: ${{ inputs.project-id }} run: | # Environment variable set by the dashcam-install action $env:PATH = "$env:DASHCAM_NODE_DIR;$env:DASHCAM_NODE_DIR\npm-installs;$env:PATH" - dashcam create --project ${{ inputs.project-id }} -t "${{ github.workflow }} ${{ github.run_number }}-${{ github.run_attempt }} - ${{ runner.name }}" -p --md >> $env:GITHUB_STEP_SUMMARY - + dashcam create --project $env:PROJECT_ID -t "${{ github.workflow }} ${{ github.run_number }}-${{ github.run_attempt }} - ${{ runner.name }}" -p --md >> $env:GITHUB_STEP_SUMMARY