answer-query #20
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: answer-query | |
on: | |
discussion: | |
types: [created, edited] | |
jobs: | |
answer-query: | |
name: answer-query | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install -r requirements.txt | |
- name: Get vector store | |
shell: bash | |
run: | | |
export LATEST_TAG=`git describe --abbrev=0 --tags` | |
wget https://github.com/hep-help/hooray/releases/download/$LATEST_TAG/hep-help-db.zip | |
unzip hep-help-db.zip | |
- name: Produce response | |
shell: bash | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
DISCUSSION_BODY: ${{ github.event.discussion.body }} | |
run: | | |
echo "$DISCUSSION_BODY" | python scripts/answer-query.py > ./text.md | |
- name: Post response | |
shell: bash | |
env: | |
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} | |
DISCUSSION_ID: ${{ github.event.discussion.node_id }} | |
run: | | |
echo "$APP_PRIVATE_KEY" > ./key.pem | |
python scripts/comment-on-discussion.py |