Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add separate updateGithub.js and updateGitlab.js scripts #526

Merged
merged 12 commits into from
Dec 18, 2023
9 changes: 0 additions & 9 deletions .github/actions/update-stars/action.yml

This file was deleted.

188 changes: 0 additions & 188 deletions .github/actions/update-stars/main.js

This file was deleted.

12 changes: 7 additions & 5 deletions .github/workflows/fetch-latest-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ jobs:
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Update stars
uses: ./.github/actions/update-stars
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update github data
run: node scripts/updateGithub.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update gitlab data
run: node scripts/updateGitlab.js
- name: Update npm data
run: node scripts/updateNpm.js
- name: Update publint data
Expand All @@ -36,6 +38,6 @@ jobs:
title: "🤖 Update data"
body: Automatically fetch latest data from GitHub, GitLab, NPM and Publint.
branch: ci-update-data
add-paths: src/lib/data/npm.json,src/lib/data/publint.json,src/lib/data/stars.json
add-paths: src/lib/data/github.json,src/lib/data/gitlab.json,src/lib/data/npm.json,src/lib/data/publint.json
delete-branch: true
token: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"format": "prettier --write ./**/*.{js,cjs,ts,css,md,svx,svelte,html,json}"
},
"devDependencies": {
"@actions/core": "^1.10.1",
"@macfja/svelte-persistent-store": "2.4.1",
"@sindresorhus/slugify": "^2.2.1",
"@sveltejs/adapter-netlify": "^3.0.0",
Expand Down
39 changes: 0 additions & 39 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions scripts/chunk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Divide an array into multiple smaller array
* @param {Array} input
* @param {number} size
* @return {Array<Array>}
*/
export function chunk(input, size) {
size = size < 1 ? 10 : size;
const pages = Math.ceil(input.length / size);
const final = [];
for (let index = 0; index < pages; index++) {
final.push(input.slice(index * size, (index + 1) * size));
}
return final;
}
Loading