-
Notifications
You must be signed in to change notification settings - Fork 70
69 lines (58 loc) · 2.22 KB
/
market-health-reporter.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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 }}