PaperBot LFL #184
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: PaperBot LFL | |
on: | |
schedule: | |
- cron: '0 14 * * *' # Runs at 7 AM PST (UTC-7) [Update this to your desired time] | |
workflow_dispatch: | |
jobs: | |
distribute: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{secrets.GH_PAT}} # Use this | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.8' # Specify your Python version | |
- name: Cache Python dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install Dependencies | |
run: | | |
pip install -r requirements.txt # Assuming you have a requirements.txt | |
- name: Run Distributor Script | |
run: python distributor.py | |
env: | |
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} | |
- name: Commit and push if there are changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add previous_titles.txt | |
if git diff --staged --quiet; then | |
echo "No changes to commit" | |
else | |
git commit -m "Update previous_titles.txt - $(date)" | |
git push | |
fi | |
env: | |
GIT_AUTHOR_EMAIL: [email protected] | |
GIT_COMMITTER_EMAIL: [email protected] | |
# Ensure the git commands use the PAT | |
GIT_HTTPS_USERNAME: LFL-Lab # update this | |
GIT_HTTPS_PASSWORD: ${{secrets.GH_PAT}} # update this |