From 34b447af03dc819d6fa241553f66b07863d7c75a Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 5 Nov 2023 15:11:22 +0200 Subject: [PATCH 1/5] Feed issue title as display name to GPT Also replace double quotes with single quotes --- .github/workflows/initiative-auto-pr.yml | 1 + scripts/gptGenerateJsonFromIssue.py | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/initiative-auto-pr.yml b/.github/workflows/initiative-auto-pr.yml index 5f9bb790..eb901c9a 100644 --- a/.github/workflows/initiative-auto-pr.yml +++ b/.github/workflows/initiative-auto-pr.yml @@ -32,6 +32,7 @@ jobs: env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} ISSUE_BODY: ${{ github.event.issue.body }} + ISSUE_TITLE: ${{ github.event.issue.title }} with: timeout_minutes: 5 max_attempts: 3 diff --git a/scripts/gptGenerateJsonFromIssue.py b/scripts/gptGenerateJsonFromIssue.py index 743bb3af..e700647a 100644 --- a/scripts/gptGenerateJsonFromIssue.py +++ b/scripts/gptGenerateJsonFromIssue.py @@ -107,8 +107,19 @@ def ask_gpt_for_initiative_json(self, issue_body: str) -> str: logging.warn("GPT did not infer function calling, best-effort answer parsing will be performed") return response_message["content"] +def get_new_initiative_details() -> str: + initiative_details = f""" + ### Initiative Display Name + {os.environ["ISSUE_TITLE"]} + + {os.environ["ISSUE_BODY"]} + """ + + # replace double-quotes with single quotes to minimize chance of invalid JSON returned by GPT + return initiative_details.replace('"', "'") + if __name__ == "__main__": - gpt_response = GPTAssistant().ask_gpt_for_initiative_json(os.environ["ISSUE_BODY"]) + gpt_response = GPTAssistant().ask_gpt_for_initiative_json(get_new_initiative_details()) respose_output_file = os.getenv("TEMP", "/tmp") + "/gpt-auto-comment.output" logging.info(f"Writing GPT Response to {respose_output_file}:\n{gpt_response}") From 88695c639b4c271d72134d9f9570387d829f818e Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 5 Nov 2023 15:19:22 +0200 Subject: [PATCH 2/5] sanitize issue title --- scripts/gptGenerateJsonFromIssue.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gptGenerateJsonFromIssue.py b/scripts/gptGenerateJsonFromIssue.py index e700647a..4af2aca4 100644 --- a/scripts/gptGenerateJsonFromIssue.py +++ b/scripts/gptGenerateJsonFromIssue.py @@ -110,7 +110,7 @@ def ask_gpt_for_initiative_json(self, issue_body: str) -> str: def get_new_initiative_details() -> str: initiative_details = f""" ### Initiative Display Name - {os.environ["ISSUE_TITLE"]} + {os.environ["ISSUE_TITLE"].replace("[NEW-INITIATIVE]:", "")} {os.environ["ISSUE_BODY"]} """ From a213ce1c6a2fbf103ccd739b6488d814bff84097 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 5 Nov 2023 16:05:01 +0200 Subject: [PATCH 3/5] Mention new itiative issue author in PR title --- .github/workflows/initiative-auto-pr.yml | 2 ++ scripts/generatePullRequestForNewInitiative.js | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/initiative-auto-pr.yml b/.github/workflows/initiative-auto-pr.yml index eb901c9a..1ec9cab5 100644 --- a/.github/workflows/initiative-auto-pr.yml +++ b/.github/workflows/initiative-auto-pr.yml @@ -40,6 +40,8 @@ jobs: - name: Generate PR uses: actions/github-script@v6 + env: + ISSUE_AUTHOR: ${{ github.event.issue.user.name }} with: script: | const script = require(process.env.GITHUB_WORKSPACE + '/scripts/generatePullRequestForNewInitiative.js') diff --git a/scripts/generatePullRequestForNewInitiative.js b/scripts/generatePullRequestForNewInitiative.js index 5604e8af..e59a50ee 100644 --- a/scripts/generatePullRequestForNewInitiative.js +++ b/scripts/generatePullRequestForNewInitiative.js @@ -39,7 +39,7 @@ module.exports = async ({github, context}) => { } const newResponse = await github.rest.pulls.create({ - title: 'New Initiative: ' + name, + title: `New Initiative: ${name} [Suggested by ${ISSUE_AUTHOR}]`, owner: context.repo.owner, repo: context.repo.repo, head: branch, @@ -120,7 +120,10 @@ module.exports = async ({github, context}) => { const PropValueUpper = value.toLocaleUpperCase("en-us"); if (upperCategoryJsonString.indexOf(PropValueUpper) !== -1) { - return await warnAndComment(`Initiative might already exist under this category, the value of property ${prop} is already present in the JSON: ${value}`, "suspected existing initiative", humanReadableJson); + return await warnAndComment( + `Initiative might already exist under this category, the value of property "${prop}" is already present in the JSON: "${value}". If you are certain this initiative doesn't exist`, + "suspected existing initiative", + humanReadableJson); } } From 1c75bb0ef3e11d52417995a585ddacff15da164a Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 5 Nov 2023 16:12:12 +0200 Subject: [PATCH 4/5] Add dev dependency for @octokit/rest required for local auto PR generation testing --- package-lock.json | 185 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 186 insertions(+) diff --git a/package-lock.json b/package-lock.json index 4e4a02c5..055d266b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,6 +31,7 @@ "remark-html": "^16.0.1" }, "devDependencies": { + "@octokit/rest": "^20.0.2", "@trivago/prettier-plugin-sort-imports": "^4.2.1", "@types/lunr": "^2.3.6", "@types/mixpanel-browser": "^2.47.4", @@ -1562,6 +1563,163 @@ "node": ">= 8" } }, + "node_modules/@octokit/auth-token": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", + "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", + "dev": true, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/core": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.0.1.tgz", + "integrity": "sha512-lyeeeZyESFo+ffI801SaBKmCfsvarO+dgV8/0gD8u1d87clbEdWsP5yC+dSj3zLhb2eIf5SJrn6vDz9AheETHw==", + "dev": true, + "dependencies": { + "@octokit/auth-token": "^4.0.0", + "@octokit/graphql": "^7.0.0", + "@octokit/request": "^8.0.2", + "@octokit/request-error": "^5.0.0", + "@octokit/types": "^12.0.0", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/endpoint": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.2.tgz", + "integrity": "sha512-qhKW8YLIi+Kmc92FQUFGr++DYtkx/1fBv+Thua6baqnjnOsgBYJDCvWZR1YcINuHGOEQt416WOfE+A/oG60NBQ==", + "dev": true, + "dependencies": { + "@octokit/types": "^12.0.0", + "is-plain-object": "^5.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/graphql": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.0.2.tgz", + "integrity": "sha512-OJ2iGMtj5Tg3s6RaXH22cJcxXRi7Y3EBqbHTBRq+PQAqfaS8f/236fUrWhfSn8P4jovyzqucxme7/vWSSZBX2Q==", + "dev": true, + "dependencies": { + "@octokit/request": "^8.0.1", + "@octokit/types": "^12.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/openapi-types": { + "version": "19.0.2", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-19.0.2.tgz", + "integrity": "sha512-8li32fUDUeml/ACRp/njCWTsk5t17cfTM1jp9n08pBrqs5cDFJubtjsSnuz56r5Tad6jdEPJld7LxNp9dNcyjQ==", + "dev": true + }, + "node_modules/@octokit/plugin-paginate-rest": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.1.2.tgz", + "integrity": "sha512-euDbNV6fxX6btsCDnZoZM4vw3zO1nj1Z7TskHAulO6mZ9lHoFTpwll6farf+wh31mlBabgU81bBYdflp0GLVAQ==", + "dev": true, + "dependencies": { + "@octokit/types": "^12.1.1" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": ">=5" + } + }, + "node_modules/@octokit/plugin-request-log": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-4.0.0.tgz", + "integrity": "sha512-2uJI1COtYCq8Z4yNSnM231TgH50bRkheQ9+aH8TnZanB6QilOnx8RMD2qsnamSOXtDj0ilxvevf5fGsBhBBzKA==", + "dev": true, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": ">=5" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.1.2.tgz", + "integrity": "sha512-JztgZ82CY4JNlPTuF0jh4iWuuGpEi5czFCoXyAbMg4F2XyFBbG5DWAKfa3odRvdZww6Df1tQgBKnqpd9X0WF9g==", + "dev": true, + "dependencies": { + "@octokit/types": "^12.1.1" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": ">=5" + } + }, + "node_modules/@octokit/request": { + "version": "8.1.4", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.1.4.tgz", + "integrity": "sha512-M0aaFfpGPEKrg7XoA/gwgRvc9MSXHRO2Ioki1qrPDbl1e9YhjIwVoHE7HIKmv/m3idzldj//xBujcFNqGX6ENA==", + "dev": true, + "dependencies": { + "@octokit/endpoint": "^9.0.0", + "@octokit/request-error": "^5.0.0", + "@octokit/types": "^12.0.0", + "is-plain-object": "^5.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/request-error": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.0.1.tgz", + "integrity": "sha512-X7pnyTMV7MgtGmiXBwmO6M5kIPrntOXdyKZLigNfQWSEQzVxR4a4vo49vJjTWX70mPndj8KhfT4Dx+2Ng3vnBQ==", + "dev": true, + "dependencies": { + "@octokit/types": "^12.0.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/rest": { + "version": "20.0.2", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-20.0.2.tgz", + "integrity": "sha512-Ux8NDgEraQ/DMAU1PlAohyfBBXDwhnX2j33Z1nJNziqAfHi70PuxkFYIcIt8aIAxtRE7KVuKp8lSR8pA0J5iOQ==", + "dev": true, + "dependencies": { + "@octokit/core": "^5.0.0", + "@octokit/plugin-paginate-rest": "^9.0.0", + "@octokit/plugin-request-log": "^4.0.0", + "@octokit/plugin-rest-endpoint-methods": "^10.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/types": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.1.1.tgz", + "integrity": "sha512-qnJTldJ1NyGT5MTsCg/Zi+y2IFHZ1Jo5+njNCjJ9FcainV7LjuHgmB697kA0g4MjZeDAJsM3B45iqCVsCLVFZg==", + "dev": true, + "dependencies": { + "@octokit/openapi-types": "^19.0.2" + } + }, "node_modules/@radix-ui/react-compose-refs": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.0.1.tgz", @@ -2464,6 +2622,12 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/before-after-hook": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", + "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", + "dev": true + }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -2889,6 +3053,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", + "dev": true + }, "node_modules/dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", @@ -4789,6 +4959,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-reference": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.2.tgz", @@ -11516,6 +11695,12 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/universal-user-agent": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", + "dev": true + }, "node_modules/update-browserslist-db": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", diff --git a/package.json b/package.json index 14b808d4..a9ad9369 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "remark-html": "^16.0.1" }, "devDependencies": { + "@octokit/rest": "^20.0.2", "@trivago/prettier-plugin-sort-imports": "^4.2.1", "@types/lunr": "^2.3.6", "@types/mixpanel-browser": "^2.47.4", From eb90f5fbae638212acd9317743cade8c09207aa2 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 5 Nov 2023 16:12:20 +0200 Subject: [PATCH 5/5] Bar213111 --- _data/links/Children/Main/links.json | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/_data/links/Children/Main/links.json b/_data/links/Children/Main/links.json index 4d0e2bf2..d26a0e3a 100644 --- a/_data/links/Children/Main/links.json +++ b/_data/links/Children/Main/links.json @@ -55,6 +55,31 @@ "description": "קוד: בריינפופ23", "url": "https://il.brainpop.com/", "website": "https://il.brainpop.com/" + }, + { + "displayName": "החמ'ל המתוק", + "name": "Bar213111", + "shortDescription": "FooBaz", + "description": "hello world", + "initiativeValidationDetails": "This initiative has been validated by the admin team", + "url": "Not Available", + "website": "Not Available", + "whatsapp": "Not Available", + "telegram": "Not Available", + "drive": "Not Available", + "form": "Not Available", + "docs": "Not Available", + "discord": "Not Available", + "facebook": "Not Available", + "instagram": "Not Available", + "tiktok": "Not Available", + "twitter": "Not Available", + "initiativeImage": "Not Available", + "tags": [ + "החמ'ל", + "מתוק", + "ילדים" + ] } ] } \ No newline at end of file