mirror of
https://github.com/LukeHagar/sveltesociety.dev.git
synced 2025-12-09 20:57:44 +00:00
chore: Edit automated PR config (#519)
* Edit PR title/body, add $lib/data folder * Remove unused scripts/updateStars.js * Load json with import assertion
This commit is contained in:
11
.github/actions/update-stars/main.js
vendored
11
.github/actions/update-stars/main.js
vendored
@@ -1,5 +1,8 @@
|
||||
import core from '@actions/core';
|
||||
import { readFileSync, writeFileSync } from 'node:fs';
|
||||
import { writeFileSync } from 'node:fs';
|
||||
import components from '../src/routes/components/components.json' assert { type: 'json' };
|
||||
import templates from '../src/routes/templates/templates.json' assert { type: 'json' };
|
||||
import tools from '../src/routes/tools/tools.json' assert { type: 'json' };
|
||||
import { fetch } from 'undici';
|
||||
|
||||
const ghGraphQlUrl = 'https://api.github.com/graphql';
|
||||
@@ -28,10 +31,6 @@ async function doGraphQlQuery(url, query, headers = {}) {
|
||||
}
|
||||
|
||||
function gatherUrls() {
|
||||
let components = JSON.parse(readFileSync('src/routes/components/components.json'));
|
||||
let tools = JSON.parse(readFileSync('src/routes/tools/tools.json'));
|
||||
let templates = JSON.parse(readFileSync('src/routes/templates/templates.json'));
|
||||
|
||||
return [
|
||||
...components.map((component) => component.repository),
|
||||
...tools.map((tool) => tool.repository),
|
||||
@@ -179,7 +178,7 @@ async function main() {
|
||||
0
|
||||
)} stars)`
|
||||
);
|
||||
writeFileSync('src/lib/stars.json', JSON.stringify({ github, gitlab }));
|
||||
writeFileSync('src/lib/data/stars.json', JSON.stringify({ github, gitlab }));
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
12
.github/workflows/fetch-latest-data.yml
vendored
12
.github/workflows/fetch-latest-data.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Fetch latest data
|
||||
name: Update data
|
||||
|
||||
on:
|
||||
schedule:
|
||||
@@ -30,10 +30,10 @@ jobs:
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
with:
|
||||
commit-message: "(AUTO) Update stars"
|
||||
title: "🤖 Update stars"
|
||||
body: Update all stars count from Github and Gitlab
|
||||
branch: ci-update-stars
|
||||
add-paths: src/lib/stars.json
|
||||
commit-message: "(AUTO) Update data"
|
||||
title: "🤖 Update data"
|
||||
body: Automatically fetch latest data from NPM, GitHub and GitLab
|
||||
branch: ci-update-data
|
||||
add-paths: src/lib/data/npm.json,src/lib/data/stars.json
|
||||
delete-branch: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user