Auto Mailer #150
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Auto Mailer | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '30 23 * * 6' | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
EMAIL: ${{ secrets.EMAIL }} | |
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} | |
TARGET_MAIL_ID: ${{ secrets.TARGET_MAIL_ID }} | |
WRITE_ACC: ${{ secrets.WRITE_ACC }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
jobs: | |
Mail: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: npm install | |
run: npm install | |
- name: env builder | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
EMAIL: ${{ secrets.EMAIL }} | |
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} | |
TARGET_MAIL_ID: ${{ secrets.TARGET_MAIL_ID }} | |
WRITE_ACC: ${{ secrets.WRITE_ACC }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: | | |
touch .env | |
echo API_KEY=${{ secrets.API_KEY }} >> .env | |
echo CLIENT_ID=${{ secrets.CLIENT_ID }} >> .env | |
echo CLIENT_SECRET=${{ secrets.CLIENT_SECRET }} >> .env | |
echo EMAIL=${{ secrets.EMAIL }} >> .env | |
echo REFRESH_TOKEN=${{ secrets.REFRESH_TOKEN }} >> .env | |
echo TARGET_MAIL_ID=${{ secrets.TARGET_MAIL_ID }} >> .env | |
echo WRITE_ACC=${{ secrets.WRITE_ACC }} >> .env | |
echo OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} >> .env | |
- name: Run Mailer | |
run: npm start |