Repository navigation
Thread Sentiment Analysis #4
This file contains hidden or 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: Thread Sentiment Analysis | |
| on: | |
| schedule: | |
| # Do not run automatically | |
| - cron: '0 0 1 1 0' | |
| jobs: | |
| post_question: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install tweepy | |
| - name: Post question | |
| env: | |
| TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} | |
| TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }} | |
| TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} | |
| TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} | |
| run: python -c "from src.thread_sentiment.main import post_question; post_question()" | |
| - name: Upload tweet ID | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: tweet_id | |
| path: tweet_id.txt | |
| analyze_and_post_sentiment: | |
| runs-on: ubuntu-latest | |
| needs: post_question | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install tweepy | |
| - name: Download tweet ID | |
| uses: actions/download-artifact@v3 | |
| with: | |
| name: tweet_id | |
| - name: Analyze and post sentiment | |
| env: | |
| TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} | |
| TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }} | |
| TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} | |
| TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} | |
| # TODO: Add environment variable for LLM API key | |
| run: python -c "from src.thread_sentiment.main import analyze_and_post_sentiment; analyze_and_post_sentiment()" |