-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (118 loc) · 4.49 KB
/
Copy pathdelete-web-resume.yml
File metadata and controls
140 lines (118 loc) · 4.49 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Delete Web Resume
on:
workflow_dispatch:
inputs:
resume_id:
description: 'Resume ID to delete (e.g., 2025_11_10_company_abc123)'
required: true
type: string
permissions:
contents: read
jobs:
delete:
runs-on: ubuntu-latest
steps:
- name: Validate input
run: |
id="${{ github.event.inputs.resume_id }}"
if [[ -z "$id" ]]; then
echo "Error: Resume ID is required"
exit 1
fi
# Validate format (basic check)
if [[ ! "$id" =~ ^[0-9]{4}_[0-9]{2}_[0-9]{2}_.+$ ]]; then
echo "Warning: Resume ID format looks unusual: $id"
echo "Expected format: YYYY_MM_DD_company_hash"
echo "Proceeding anyway..."
fi
echo "Will delete resume: $id"
- name: Clone CV-pages repository
env:
CV_PAGES_TOKEN: ${{ secrets.CV_PAGES_TOKEN }}
run: |
git clone https://x-access-token:${CV_PAGES_TOKEN}@github.com/datarian/CV-pages.git cv-pages-repo
cd cv-pages-repo
git checkout gh-pages
- name: Check if resume exists
id: check
run: |
cd cv-pages-repo
id="${{ github.event.inputs.resume_id }}"
target_dir="cv/$id"
if [ -d "$target_dir" ]; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Resume found at: $target_dir"
echo "Contents:"
ls -la "$target_dir"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Error: Resume not found at: $target_dir"
echo "Available resumes:"
ls -1 cv/ 2>/dev/null || echo "No resumes found"
exit 1
fi
- name: Delete resume
if: steps.check.outputs.exists == 'true'
run: |
cd cv-pages-repo
id="${{ github.event.inputs.resume_id }}"
target_dir="cv/$id"
echo "Deleting: $target_dir"
rm -rf "$target_dir"
# Update manifest if exists
manifest="cv/.manifest.json"
if [ -f "$manifest" ]; then
echo "Updating manifest..."
# Simple approach: remove entry (would use jq in production)
# For now, just note that manual cleanup may be needed
echo "Note: Manifest may need manual cleanup"
fi
- name: Commit and push deletion
if: steps.check.outputs.exists == 'true'
env:
CV_PAGES_TOKEN: ${{ secrets.CV_PAGES_TOKEN }}
run: |
cd cv-pages-repo
id="${{ github.event.inputs.resume_id }}"
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add .
git commit -m "$(cat <<'EOF'
chore: delete web resume $id [skip ci]
Manually deleted via workflow from datarian/CV.
🤖 Triggered by ${{ github.actor }}
EOF
)" || echo "No changes to commit"
git push https://x-access-token:${CV_PAGES_TOKEN}@github.com/datarian/CV-pages.git gh-pages
- name: Report deletion
if: steps.check.outputs.exists == 'true'
run: |
id="${{ github.event.inputs.resume_id }}"
echo "## 🗑️ Deletion Complete" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Deleted resume: **$id**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "The following URL is now inactive:" >> $GITHUB_STEP_SUMMARY
echo "- ~~https://datarian.github.io/CV-pages/cv/$id~~" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Deletion committed to CV-pages repository." >> $GITHUB_STEP_SUMMARY
- name: List remaining resumes
if: steps.check.outputs.exists == 'true'
run: |
cd cv-pages-repo
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Remaining Resumes" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -d "cv" ]; then
count=$(ls -1 cv/ | grep -v "^\." | grep -v "robots.txt" | wc -l | tr -d ' ')
echo "Total: $count resume(s)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
for dir in cv/*/; do
resume_id=$(basename "$dir")
if [ "$resume_id" != ".*" ]; then
echo "- https://datarian.github.io/CV-pages/cv/$resume_id" >> $GITHUB_STEP_SUMMARY
fi
done
else
echo "No resumes remaining." >> $GITHUB_STEP_SUMMARY
fi