tweet #12260
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: tweet | |
on: | |
# push: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 * * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
NODE_VERSION: 16 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Set up Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Create .env file | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
API_KEY_SECRET: ${{ secrets.API_KEY_SECRET }} | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
ACCESS_SECRET: ${{ secrets.ACCESS_SECRET }} | |
run: | | |
touch .env | |
echo API_KEY=$API_KEY >> .env | |
echo API_KEY_SECRET=$API_KEY_SECRET >> .env | |
echo ACCESS_TOKEN=$ACCESS_TOKEN >> .env | |
echo ACCESS_SECRET=$ACCESS_SECRET >> .env | |
- name: Install packages | |
run: npm ci | |
- name: Update atlas | |
run: npm run download:atlas | |
- name: Create drawing and tweet it | |
run: npm start | |
- name: Commit files | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit --allow-empty -m "New drawing" | |
- name: Push changes | |
uses: ad-m/github-push-action@8407731efefc0d8f72af254c74276b7a90be36e1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |