@@ -15,66 +15,66 @@ jobs:
1515 - name : 📥 Checkout repository
1616 uses : actions/checkout@v4
1717
18- # First try to download previous artifacts to have as fallback
19- - name : 📥 Download previous formal spec HTML for fallback
20- id : download_previous
21- uses : actions/download-artifact@v4
22- continue-on-error : true
23- with :
24- name : formal-spec-html
25- path : previous-formal-spec-html
26-
27- - name : Check previous artifacts
28- id : check_previous
29- run : |
30- if [ -d "previous-formal-spec-html" ] && [ -n "$(ls -A previous-formal-spec-html 2>/dev/null)" ]; then
31- echo "Previous formal spec HTML found, will use as fallback"
32- echo "has_previous=true" >> $GITHUB_OUTPUT
33- else
34- echo "No previous formal spec HTML found"
35- echo "has_previous=false" >> $GITHUB_OUTPUT
36- fi
37-
3818 # Try to download directly from GitHub API to see artifacts in the formal-spec repo
3919 - name : List available artifacts in formal-spec repo
20+ id : list_artifacts
4021 run : |
41- curl -s -H "Authorization: token ${{ secrets.LEIOS_TRIGGER_PAT }}" \
42- "https://api.github.com/repos/input-output-hk/ouroboros-leios-formal-spec/actions/artifacts" | \
43- jq '.artifacts[] | {name: .name, id: .id, created_at: .created_at, expired: .expired}' || true
22+ ARTIFACTS=$(curl -s -H "Authorization: token ${{ secrets.LEIOS_TRIGGER_PAT }}" \
23+ "https://api.github.com/repos/input-output-hk/ouroboros-leios-formal-spec/actions/artifacts")
24+
25+ echo "Available artifacts:"
26+ echo "$ARTIFACTS" | jq '.artifacts[] | {name: .name, id: .id, created_at: .created_at, expired: .expired, workflow_run: .workflow_run.id}' || true
27+
28+ # Find the most recent formal-spec-html artifact ID
29+ ARTIFACT_ID=$(echo "$ARTIFACTS" | jq -r '.artifacts[] | select(.name=="formal-spec-html" and .expired==false) | .id' | head -n 1)
4430
45- - name : 📥 Download formal spec HTML
46- id : download_new
31+ if [ -n "$ARTIFACT_ID" ]; then
32+ echo "Found formal-spec-html artifact with ID: $ARTIFACT_ID"
33+ echo "artifact_id=$ARTIFACT_ID" >> $GITHUB_OUTPUT
34+ else
35+ echo "No valid formal-spec-html artifact found"
36+ fi
37+
38+ - name : 📥 Download formal spec HTML by run ID
39+ id : download_by_run
40+ if : github.event.client_payload.run_id != ''
4741 uses : actions/download-artifact@v4
4842 continue-on-error : true
4943 with :
5044 name : formal-spec-html
5145 repository : input-output-hk/ouroboros-leios-formal-spec
5246 run-id : ${{ github.event.client_payload.run_id }}
53- path : new- formal-spec-html
47+ path : formal-spec-html
5448 github-token : ${{ secrets.LEIOS_TRIGGER_PAT }}
5549
56- - name : Prepare final formal spec HTML
50+ - name : 📥 Download formal spec HTML by artifact ID (fallback)
51+ id : download_by_id
52+ if : steps.download_by_run.outcome != 'success' && steps.list_artifacts.outputs.artifact_id != ''
53+ uses : dawidd6/action-download-artifact@v6
54+ continue-on-error : true
55+ with :
56+ name : formal-spec-html
57+ repo : input-output-hk/ouroboros-leios-formal-spec
58+ workflow : formal-spec.yaml
59+ path : formal-spec-html
60+ github_token : ${{ secrets.LEIOS_TRIGGER_PAT }}
61+ search_artifacts : true
62+ if_no_artifact_found : warn
63+
64+ - name : Check download and create placeholder if needed
5765 run : |
5866 mkdir -p formal-spec-html
5967
60- # Check if we successfully downloaded new files
61- if [ -d "new-formal-spec-html" ] && [ -n "$(ls -A new-formal-spec-html 2>/dev/null)" ]; then
62- echo "Using newly downloaded formal spec HTML"
63- cp -r new-formal-spec-html/* formal-spec-html/
64- # Otherwise use previous version if available
65- elif [ "${{ steps.check_previous.outputs.has_previous }}" == "true" ]; then
66- echo "Download failed, using previous formal spec HTML as fallback"
67- cp -r previous-formal-spec-html/* formal-spec-html/
68- # Create placeholder as last resort
68+ # Check if we successfully downloaded files
69+ if [ -n "$(ls -A formal-spec-html 2>/dev/null)" ]; then
70+ echo "Using downloaded formal spec HTML"
71+ echo "Files in formal-spec-html directory:"
72+ ls -la formal-spec-html/
6973 else
7074 echo "No formal spec HTML available, creating placeholder"
7175 echo "<html><body><h1>Formal Specification</h1><p>Formal specification documentation is being updated. Please check back later.</p></body></html>" > formal-spec-html/index.html
7276 fi
7377
74- # Show what we're using
75- echo "Final formal spec HTML contents:"
76- ls -la formal-spec-html/
77-
7878 - name : 🚢 Upload formal spec files
7979 uses : actions/upload-artifact@v4
8080 with :
0 commit comments