Skip to content

Commit

Permalink
fix: Fix header check
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 committed Dec 15, 2023
1 parent cfcc085 commit 5235c97
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/autoSubmit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { resolve } from 'node:path';

import { formatAgentJSON } from './check';
import { agentsDir, githubHomepage } from './const';
import { getLocaleAgentFileName, writeJSON } from './utils';
import {checkHeader, getLocaleAgentFileName, writeJSON} from './utils';

const GENERATE_LABEL = '🤖 Agent PR';
const SUCCESS_LABEL = '✅ Auto Check Pass';
Expand Down Expand Up @@ -206,7 +206,7 @@ class AutoSubmit {
let currentValue = '';

for (const line of lines) {
if (line.startsWith('###')) {
if (checkHeader(line)) {
if (currentKey && currentValue) {
json[currentKey] = currentValue.trim();
currentValue = '';
Expand Down
17 changes: 17 additions & 0 deletions scripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,20 @@ export const updateAwesomeReadme = (md: string, prompts: string): string => {

return mds.join(readmeSplit);
};

export const checkHeader = (line: string) => {
const header = [
'### systemRole',
'### identifier',
'### avatar',
'### title',
'### description',
'### tags',
'### locale',
]
let check = false;
header.forEach((item) => {
if (line.startsWith(item)) check = true;
})
return check;
}

0 comments on commit 5235c97

Please sign in to comment.