-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (72 loc) · 2.82 KB
/
Copy pathcheck-updates.yml
File metadata and controls
86 lines (72 loc) · 2.82 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
78
79
80
81
82
83
84
85
86
name: Check Tool Updates
on:
schedule:
- cron: '0 7 * * 1' # Every Monday at 07:00 UTC
workflow_dispatch: # Allow manual trigger from the Actions tab
permissions:
contents: read
issues: write
jobs:
check-updates:
name: Check tool versions against upstream
runs-on: ubuntu-latest
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
submodules: false # tools/ submodule only; prebuilt/ not needed
- run: git submodule update --init tools
- name: Check for updates
id: check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set +e
bash scripts/internal/check-updates.sh --json > /tmp/updates.json
EXIT_CODE=$?
set -e
# Exit 0 = all up-to-date, Exit 1 = updates available, Exit 2 = error
if [[ $EXIT_CODE -eq 2 ]]; then
echo "check-updates.sh returned a fatal error" >&2
cat /tmp/updates.json >&2
exit 2
fi
UPDATES_AVAILABLE=$(python3 -c "import json; d=json.load(open('/tmp/updates.json')); print('true' if any(t['status']=='update available' for t in d) else 'false')")
echo "updates_available=$UPDATES_AVAILABLE" >> "$GITHUB_OUTPUT"
- name: Format issue body
id: format
if: steps.check.outputs.updates_available == 'true'
run: python3 scripts/internal/lib/format-update-report.py /tmp/updates.json > /tmp/issue_body.md
- name: Find or update tracking issue
if: steps.check.outputs.updates_available == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
EXISTING=$(gh issue list \
--label "tool-updates" \
--state open \
--limit 1 \
--json number \
--jq '.[0].number // empty')
TITLE="[tool-updates] Upstream tool versions available — $(date +%Y-%m-%d)"
if [[ -n "$EXISTING" ]]; then
gh issue comment "$EXISTING" --body-file /tmp/issue_body.md
echo "Added comment to existing issue #$EXISTING"
else
gh issue create \
--title "$TITLE" \
--body-file /tmp/issue_body.md \
--label "tool-updates"
fi
- name: All tools up to date
if: steps.check.outputs.updates_available == 'false'
run: echo "All GitHub-tracked tools are at their latest stable release."
- name: Upload JSON report
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: update-report-${{ github.run_id }}
path: /tmp/updates.json
retention-days: 30