RAG Implementation for Market Health Reporter #249
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
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
market-analysis: | |
runs-on: ubuntu-latest | |
name: "Perform market analysis" | |
if: | | |
!github.event.issue.pull_request && | |
contains(github.event.comment.body, 'analyze:') | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Python | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pypoetry | |
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
- name: Install package | |
run: pipx install poetry && poetry install --no-interaction | |
- name: Run script | |
run: | | |
poetry run market-health-reporter \ | |
--issue "${{ github.event.issue.number }}" \ | |
--comment-body "${{ github.event.comment.body }}" \ | |
--github-token "${{ secrets.GITHUB_TOKEN }}" \ | |
--llm-api-key "${{ secrets.OPENAI_KEY }}" \ | |
--rapid-api "${{ secrets.RAPID_API_KEY }}" | |
- name: Configure Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
- name: Create new branch | |
run: | | |
git checkout -b new-branch-${{ github.run_id }} | |
echo "Creating a new branch" | |
- name: Add new files | |
run: | | |
git add . | |
echo "Adding new files" | |
- name: Commit new files | |
run: | | |
git commit -m "Add new market analysis data and a report" | |
git status | |
- name: Push changes | |
run: | | |
git push origin new-branch-${{ github.run_id }} | |
echo "Pushing changes to origin" | |
git log origin/new-branch-${{ github.run_id }} --oneline | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create a PR from the branch with the commit | |
run: | | |
PR_TITLE="${{ github.event.comment.body }}" | |
PR_URL=$(gh pr create --fill --base main --head new-branch-${{ github.run_id }} --title "$PR_TITLE" --body "This PR adds new market analysis data and a report." --repo ${{ github.repository }}) | |
echo "PR created at URL: $PR_URL" | |
echo "PR_URL=$PR_URL" >> $GITHUB_ENV | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |