Fixed Winget Dependency in action workflow #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Repository And Package Scan on Virus Total | |
on: | |
workflow_dispatch: | |
release: # to trigger on releases | |
pull_request: | |
types: | |
- closed # When a pull request is closed. Merging also results in closing the pull request. | |
jobs: | |
run-script: | |
name: Run VirusTotal Analysis | |
runs-on: windows-latest | |
steps: | |
# Step to check out the repository | |
- uses: actions/checkout@v4 | |
# Step to create ZIP of the repository | |
- name: Create a zip file of the entire repository | |
shell: pwsh | |
run: | | |
Compress-Archive -Path '*' -DestinationPath 'Harden-Windows-Security-Repository.zip' | |
Write-Host "Repository ZIP created." | |
# Step to fetch the latest release and download attached files to a separate folder | |
- name: Fetch Latest Release Files | |
id: get_release_files | |
shell: pwsh | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub API access token | |
run: | | |
$null = New-Item -Path './release_assets' -ItemType Directory # Create folder for release assets | |
# Get latest release information from GitHub API | |
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/releases/latest" -Headers @{Authorization = "token $env:GITHUB_TOKEN"} -UseBasicParsing | |
# Download assets if they exist | |
if ($release.assets.Count -gt 0) { | |
foreach ($asset in $release.assets) { | |
$assetUrl = $asset.browser_download_url | |
$assetName = $asset.name | |
# Download each asset into the release_assets folder | |
Invoke-WebRequest -Uri $assetUrl -OutFile "./release_assets/$assetName" | |
Write-Host "Downloaded: $assetName" | |
} | |
} else { | |
Write-Host "No assets found in the latest release." | |
} | |
# Run the VirusTotal PowerShell script to upload all files | |
- name: Run VirusTotal Script | |
env: | |
VTAPIsecret: ${{ secrets.VTNEWAPI }} # VirusTotal API key | |
shell: pwsh | |
run: | | |
# Path to VirusTotal script | |
./.github/Workflowstuff/VirusTotal.ps1 |