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

Check the latest cellDeps #20

Merged
merged 2 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .github/workflows/update.yml → .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: Update CellDeps
# Every 30 Minutes
name: Check CellDeps
# Every day at midnight (UTC)

on:
pull_request:
# schedule:
# - cron: '*/30 * * * *' # Run every 30 minutes

schedule:
- cron: '0 0 * * *' # Run every day at midnight (UTC)
jobs:
Update:
Check:
runs-on: ubuntu-latest

steps:
Expand All @@ -24,6 +23,6 @@ jobs:
- name: Install dependency
run: pnpm install

- name: Update CellDeps
- name: Check CellDeps
run: |
pnpm update:cellDeps
pnpm check:cellDeps
14 changes: 14 additions & 0 deletions deployment/cell-deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,20 @@
"txHash": "0x8ec1081bd03e5417bb4467e96f4cec841acdd35924538a35e7547fe320118977"
},
"depType": "code"
},
"0xcc9dc33ef234e14bc788c43a4848556a5fb16401a04662fc55db9bb201987037": {
"outPoint": {
"index": "0x0",
"txHash": "0xaec423c2af7fe844b476333190096b10fc5726e6d9ac58a9b71f71ffac204fee"
},
"depType": "code"
},
"0xbfa35a9c38a676682b65ade8f02be164d48632281477e36f8dc2f41f79e56bfc": {
"outPoint": {
"index": "0x0",
"txHash": "0xf6a5eef65101899db9709c8de1cc28f23c1bee90d857ebe176f6647ef109e20d"
},
"depType": "code"
}
}
}
27 changes: 27 additions & 0 deletions lib/check.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import * as fs from 'fs';
import * as path from 'path';
import * as core from '@actions/core'
import { fetchCellDeps } from './fetcher';

const checkCellDeps = async () => {
const jsonData = await fetchCellDeps();
// Specify the file path
const __dirname = path.dirname(new URL(import.meta.url).pathname);
const filePath = path.join(__dirname, '..', 'deployment/cell-deps.json');

// Write JSON string to file
try {
const fileData = fs.readFileSync(filePath, 'utf8');
console.log('Successfully read file:', filePath);
if (fileData === jsonData) {
console.log('Cell Deps have not changed');
} else {
core.setFailed('Cell Deps have changed and a new Pull Request should be created');
}
} catch (err) {
console.error('Error reading file:', err);
return;
}
};

checkCellDeps();
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@
"type": "module",
"scripts": {
"update:cellDeps": "npx tsx lib/index.ts",
"check:cellDeps": "npx tsx lib/check.ts",
"format": "prettier --write '{lib, api}/*.ts'",
"lint": "eslint --ext .ts",
"test": "npx tsx lib/test.ts"
},
"dependencies": {
"@actions/core": "^1.11.1",
"@rgbpp-sdk/ckb": "^0.6.0",
"axios": "^1.6.8",
"zod": "^3.23.8"
},
"devDependencies": {
"@vercel/node": "^3.2.23",
"@types/lodash": "^4.17.0",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"@vercel/node": "^3.2.23",
"eslint": "^8.56.0",
"prettier": "^3.2.5",
"tsx": "^4.19.2",
Expand Down
Loading
Loading