Scheduler #14793
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: "Scheduler" | |
on: | |
schedule: | |
- cron: "0 * * * *" | |
jobs: | |
tweet: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
php: [8.1] | |
dependency-version: [prefer-stable] | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v2 | |
- name: setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: composer | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction | |
- name: Run the script | |
env: | |
MARVEL_PUBLIC_KEY: ${{ secrets.MARVEL_PUBLIC_KEY }} | |
MARVEL_PRIVATE_KEY: ${{ secrets.MARVEL_PRIVATE_KEY }} | |
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} | |
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} | |
TWITTER_ACCOUNT_ID: ${{ secrets.TWITTER_ACCOUNT_ID }} | |
TWITTER_BEARER_TOKEN: ${{ secrets.TWITTER_BEARER_TOKEN }} | |
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} | |
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }} | |
run: php project/run.php | |
- name: Commit and push db.sqlite update | |
run: | | |
git config user.name "Julien SCHMITT" | |
git config user.email "jschmitt95@protonmail.com" | |
git add -A | |
timestamp=$(date -u) | |
git commit -m "Last Commit: ${timestamp}(TW)" || exit 0 | |
git push origin master |