-
Notifications
You must be signed in to change notification settings - Fork 58
77 lines (68 loc) · 3.16 KB
/
Copy pathcheck-hve-core-freshness.yml
File metadata and controls
77 lines (68 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: hve-core Upstream Freshness
on:
schedule:
# Weekly: Mondays at 09:30 UTC (after binary integrity 09:00)
- cron: "30 9 * * 1"
workflow_dispatch:
permissions:
contents: read
issues: write
concurrency:
group: check-hve-core-freshness
cancel-in-progress: false
defaults:
run:
shell: pwsh
jobs:
check-freshness:
name: Check hve-core Upstream Freshness
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check hve-core-derived files against reviewed upstream baselines
id: check
env:
GH_TOKEN: ${{ github.token }}
run: ./scripts/security/Test-HveCoreFreshness.ps1
- name: Create or update tracking issue
if: "!cancelled() && steps.check.outputs.attention-count != '' && steps.check.outputs.attention-count != '0'"
env:
GH_TOKEN: ${{ github.token }}
DRIFT_COUNT: ${{ steps.check.outputs.drift-count }}
ERROR_COUNT: ${{ steps.check.outputs.error-count }}
run: |
. ./scripts/security/Test-HveCoreFreshness.ps1
$data = Get-Content 'hve-core-freshness-results.json' -Raw | ConvertFrom-Json
$runUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"
$checkDate = Get-Date -Format 'yyyy-MM-dd' -AsUTC
$body = Format-HveCoreIssueBody -Result $data -RunUrl $runUrl -CheckDate $checkDate
$title = "security: hve-core freshness needs attention ($env:DRIFT_COUNT drifted, $env:ERROR_COUNT check errors)"
$existing = Get-HveCoreTrackingIssue
if ($existing) {
gh issue edit $existing --title $title --body $body
if ($LASTEXITCODE -ne 0) { throw "Could not update hve-core freshness issue #$existing" }
gh issue comment $existing --body "🔄 Weekly scan: $env:DRIFT_COUNT drifted, $env:ERROR_COUNT check errors as of $checkDate. [Workflow run]($runUrl)."
}
else { gh issue create --title $title --body $body --label "dependencies,automated,needs-triage" }
- name: Close resolved tracking issue
if: steps.check.outputs.attention-count == '0'
env:
GH_TOKEN: ${{ github.token }}
run: |
. ./scripts/security/Test-HveCoreFreshness.ps1
$existing = Get-HveCoreTrackingIssue
if ($existing) { $checkDate = Get-Date -Format 'yyyy-MM-dd' -AsUTC; gh issue close $existing --comment "✅ hve-core-derived files are current as of $checkDate." }
else { Write-Host "All current, no open tracking issue." }
- name: Write job summary
if: always()
run: |
if (-not (Test-Path 'hve-core-freshness-results.json')) { "## hve-core Upstream Freshness`n`n⚠️ Check did not complete." >> $env:GITHUB_STEP_SUMMARY; return }
. ./scripts/security/Test-HveCoreFreshness.ps1
$data = Get-Content 'hve-core-freshness-results.json' -Raw | ConvertFrom-Json
Format-HveCoreJobSummary -Result $data >> $env:GITHUB_STEP_SUMMARY