Daily LinkedIn Post #24
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: Daily LinkedIn Post | |
| on: | |
| schedule: | |
| - cron: '0 9 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| post: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 360 # 6 hours max (GitHub Actions free tier limit) | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests python-dateutil groq python-dotenv | |
| - name: Run LinkedIn Post Bot | |
| env: | |
| LINKEDIN_ACCESS_TOKEN: ${{ secrets.LINKEDIN_ACCESS_TOKEN }} | |
| LINKEDIN_USER_URN: ${{ secrets.LINKEDIN_USER_URN }} | |
| GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} | |
| UNSPLASH_ACCESS_KEY: ${{ secrets.UNSPLASH_ACCESS_KEY }} | |
| # Prefer a repo secret `MY_GITHUB_USERNAME`; if not set, fall back to the workflow actor | |
| MY_GITHUB_USERNAME: ${{ secrets.MY_GITHUB_USERNAME || github.actor }} | |
| # Pass token for authenticated API calls: prefer custom secret, otherwise built-in GITHUB_TOKEN | |
| MY_GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | |
| run: python bot.py | |
| - name: Upload last generated post | |
| if: always() | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: generated-posts | |
| path: last_generated_post.txt | |
| retention-days: 60 |