ci: migrate GitHub actions to Gitea actions
Deploy CV Site (andreknie.de) / deploy (push) Canceled after 0s
Deploy CV Site (andreknie.de) / deploy (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import matter from 'gray-matter'
|
||||
|
||||
const CONTENT_DIR = path.join(process.cwd(), 'content')
|
||||
const POSTS_DIR = path.join(CONTENT_DIR, 'posts')
|
||||
|
||||
function getFiles(dir) {
|
||||
return fs.readdirSync(dir).map(f => path.join(dir, f)).filter(f => f.endsWith('.md'))
|
||||
}
|
||||
|
||||
const allPosts = getFiles(POSTS_DIR)
|
||||
allPosts.forEach(post => {
|
||||
if (fs.existsSync(post)) {
|
||||
const pData = matter(fs.readFileSync(post, 'utf8'))
|
||||
let dateStr = ''
|
||||
if (pData.data.date instanceof Date) {
|
||||
dateStr = pData.data.date.toISOString()
|
||||
} else if (typeof pData.data.date === 'string') {
|
||||
dateStr = pData.data.date
|
||||
}
|
||||
|
||||
// If date is July 18, 2026 or July 17, 2026
|
||||
if (dateStr.includes('2026-07-18') || dateStr.includes('2026-07-17')) {
|
||||
// It's a duplicate of a properly dated file. Delete it.
|
||||
fs.unlinkSync(post)
|
||||
console.log(`🗑️ Deleted wrongly dated file: ${path.basename(post)}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user