Skip to content

Commit

Permalink
feat: Separate github and gitlab scripts (#526)
Browse files Browse the repository at this point in the history
* feat: Add updateGitlab.js

* feat: Add updateGithub.js

* Remove stars action

* Remove @actions/core

* Add injectors

* Fix matching repo URLs

* Format

* Simplify injectData

* Add shared chunk.js file
  • Loading branch information
lachlancollins authored Dec 18, 2023
1 parent 2054e0b commit ea37aa2
Show file tree
Hide file tree
Showing 16 changed files with 709 additions and 786 deletions.
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

0 comments on commit ea37aa2

Please sign in to comment.