warnings #12
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: warnings | |
on: | |
schedule: | |
- cron: '*/10 * * * *' # <-- Set your cron here (UTC). Uses github which can be ~2-10 mins late. | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout this repo into the Github Actions runner | |
uses: actions/checkout@master | |
with: | |
fetch-depth: 1 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
id: npm-cache | |
with: | |
path: '**/warnings/node_modules' | |
key: ${{ runner.os }}-modules-${{ hashFiles('package-lock.json') }} | |
- name: Install packages if there's no cache | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: |- | |
cd ./"$GITHUB_WORKFLOW" | |
echo "$NPMRC" | base64 --decode > .npmrc | |
npm ci | |
# - name: Set up Python 3.10 | |
# uses: actions/setup-python@v4 | |
# with: | |
# python-version: '3.10' | |
- name: Start the data processing using make | |
env: | |
BOT_NAME: ${{ github.workflow }} # <-- This makes you bot name available to scripts | |
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} | |
# MY_API_KEY: ${{ secrets.MY_API_KEY }} # <-- Can make available additional repository secrets here | |
uses: nick-fields/retry@v2 | |
with: | |
max_attempts: 5 | |
retry_on: error | |
timeout_minutes: 5 | |
retry_wait_seconds: 30 | |
command: cd warnings && make all | |
- name: Commit and push to main branch | |
run: |- | |
git config user.name "Automated" | |
git config user.email "actions@users.noreply.github.com" | |
git add -A | |
timestamp=$(date -u) | |
git commit -m "Updated at: ${timestamp}" || exit 0 | |
git push origin main | |
- name: Report status | |
uses: ravsamhq/notify-slack-action@v2 | |
if: always() | |
with: | |
status: ${{ job.status }} | |
notification_title: '*Bot issue:*' | |
message_format: '{emoji} *{workflow}* bot has {status_message}.' | |
footer: '<{run_url}|View this run on Github.>' | |
notify_when: 'failure' | |
# mention_users: 'W019660LURJ' # <-- optionally mention users (here, @johnkeefe) | |
# mention_users_when: 'failure,warnings' # <-- | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.WEATHER_ERRORS_SLACK_WEBHOOK }} | |