Updated chatgpt.getNewChatButton()
to work in Logged Out session
#120
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync chatgpt.js to (/starters/chrome && KudoAI/chatgpt.js-chrome-starter)/extension/lib/chatgpt.js | |
on: | |
push: | |
branches: [master, main] | |
paths: [chatgpt.js] | |
jobs: | |
build: | |
if: (github.repository == 'KudoAI/chatgpt.js') && (github.event.commits[0].committer.username != 'kudo-sync-bot') | |
runs-on: ubuntu-latest | |
env: | |
GIT_AUTHOR_NAME: ${{ github.event.commits[0].author.name }} | |
GIT_AUTHOR_EMAIL: ${{ github.event.commits[0].author.email }} | |
GIT_COMMITTER_NAME: kudo-sync-bot | |
GIT_COMMITTER_EMAIL: [email protected] | |
steps: | |
- name: Checkout KudoAI/chatgpt.js | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.REPO_SYNC_PAT }} | |
repository: KudoAI/chatgpt.js | |
path: KudoAI/chatgpt.js | |
- name: Checkout KudoAI/chatgpt.js-chrome-starter | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.REPO_SYNC_PAT }} | |
repository: KudoAI/chatgpt.js-chrome-starter | |
path: KudoAI/chatgpt.js-chrome-starter | |
- name: Sync chatgpt.js to /starters/chrome/extension/lib/chatgpt.js + update version in manifest.json | |
run: | | |
cp -f \ | |
"${{ github.workspace }}/KudoAI/chatgpt.js/chatgpt.js" \ | |
"${{ github.workspace }}/KudoAI/chatgpt.js/starters/chrome/extension/lib/chatgpt.js" | |
echo "export { chatgpt };" >> "${{ github.workspace }}/KudoAI/chatgpt.js/starters/chrome/extension/lib/chatgpt.js" | |
cd "${{ github.workspace }}/KudoAI/chatgpt.js/starters/chrome/extension" | |
sed -i -E "s/\"version\": \"([0-9]+\.[0-9]+\.[0-9]+)\.*([0-9]*)\"/\"version\": \"$(date +'%Y.%-m.%-d')\"/g" manifest.json | |
- name: Sync chatgpt.js to KudoAI/chatgpt.js-chrome-starter/extension/lib/chatgpt.js + update version in manifest.json | |
run: | | |
cp -f \ | |
"${{ github.workspace }}/KudoAI/chatgpt.js/chatgpt.js" \ | |
"${{ github.workspace }}/KudoAI/chatgpt.js-chrome-starter/extension/lib/chatgpt.js" | |
echo "export { chatgpt };" >> "${{ github.workspace }}/KudoAI/chatgpt.js-chrome-starter/extension/lib/chatgpt.js" | |
cd "${{ github.workspace }}/KudoAI/chatgpt.js-chrome-starter/extension" | |
sed -i -E "s/\"version\": \"([0-9]+\.[0-9]+\.[0-9]+)\.*([0-9]*)\"/\"version\": \"$(date +'%Y.%-m.%-d')\"/g" manifest.json | |
- name: Escape backticks in commit msg | |
env: | |
COMMIT_MSG: ${{ github.event.head_commit.message }} | |
run: | | |
echo "ESCAPED_MSG<<EOF" >> $GITHUB_ENV | |
echo "$COMMIT_MSG" | sed 's/`/\`/g' >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Push changes to KudoAI/chatgpt.js | |
run: | | |
cd ${{ github.workspace }}/KudoAI/chatgpt.js | |
git add . | |
git commit -n -m "$ESCAPED_MSG ↞ [auto-sync from \`KudoAI/chatgpt.js\`]" || true | |
git push | |
- name: Push changes to KudoAI/chatgpt.js-chrome-starter | |
run: | | |
cd ${{ github.workspace }}/KudoAI/chatgpt.js-chrome-starter | |
git add . | |
git commit -n -m "$ESCAPED_MSG↞ [auto-sync from \`KudoAI/chatgpt.js\`]" || true | |
git push |