diff --git a/.github/workflows/cleaner.js b/.github/workflows/updater.js similarity index 92% rename from .github/workflows/cleaner.js rename to .github/workflows/updater.js index e5a3b688f3..af31653f94 100644 --- a/.github/workflows/cleaner.js +++ b/.github/workflows/updater.js @@ -156,11 +156,25 @@ async function validate(type) { console.log(`Repo: ${owner}/${repo}, Stars: ${stars}, Archived: ${isArchived}, Last Commit Date: ${lastCommitDate}`); const newOwner = entry.owner.login; const newRepo = entry.name; + + // Update link if repository has been renamed if (owner !== newOwner || repo !== newRepo) { console.log(`Repo: ${owner}/${repo} has been renamed to ${newOwner}/${newRepo}`); content.link = `https://github.com/${newOwner}/${newRepo}`; - fs.writeFileSync(file, yaml.dump(content)); } + + // Initialize repository object if it doesn't exist + if (!content.repository) { + content.repository = {}; + } + + // Update repository information + content.repository = { + is_archived: isArchived, + stars: stars, + last_commit_date: lastCommitDate + }; + fs.writeFileSync(file, yaml.dump(content)); } else { console.log(`Repo: ${owner}/${repo} does not exist or is private.`); console.log(`Remove: ${file}`); diff --git a/.github/workflows/cleaner.yml b/.github/workflows/updater.yml similarity index 96% rename from .github/workflows/cleaner.yml rename to .github/workflows/updater.yml index 1441ab2075..3d924b2675 100644 --- a/.github/workflows/cleaner.yml +++ b/.github/workflows/updater.yml @@ -1,4 +1,4 @@ -name: Cleaner +name: Updater on: schedule: @@ -23,7 +23,7 @@ jobs: - name: Install Dependencies run: npm install - name: Cleanup - run: node .github/workflows/cleaner.js + run: node .github/workflows/updater.js env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Config