Skip to content

Commit

Permalink
action updated
Browse files Browse the repository at this point in the history
  • Loading branch information
aldoyh authored Aug 29, 2023
1 parent 416621c commit 50d39d0
Showing 1 changed file with 26 additions and 71 deletions.
97 changes: 26 additions & 71 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,26 @@
name: ReadMe Worker 🚧

on:
workflow_dispatch:
schedule:
# Runs every minute
- cron: "* */8 * * *"

jobs:
build:
name: Build 👔
runs-on: ubuntu-latest
steps:
- name: Checkout code ⛵️
uses: actions/checkout@v3
with:
ref: main
token: ${{ secrets.GH_PAT }} # make sure this secret is available in your repo settings

- name: Setup new branch 🌿
run: |
git config --global user.email "aldoyh@gmail.com"
git config --global user.name "Mastermind ⛵️"
git checkout -b todoist-stats-update
- name: Update todoist stats 📊
uses: aldoyh/todoist-readme@master
outputs:
report: ${{ steps.todoist-stats.outputs.report }}
with:
TODOIST_API_KEY: ${{ secrets.TODOIST_API_KEY }}

- name: Check for changes in README.md 📝
id: diff-check
run: |
git diff --exit-code --quiet origin/main README.md || echo "difference=true" >> $GITHUB_ENV
deploy:
name: Deployment ⛴️
runs-on: ubuntu-latest
needs: build
steps:
- name: Commit and push changes 🚀
run: |
if [[ "${{ env.difference }}" == "true" ]]; then
git add .
git commit -m "Update todoist stats"
git fetch origin todoist-stats-update
git reset --hard origin/todoist-stats-update
git push --force-with-lease origin/todoist-stats-update
else
echo "No changes in README.md"
fi
echo "🚧 Diff: ${{ env.difference }}"
- name: Merge into main 📦
run: |
if [[ "${{ env.difference }}" == "true" ]]; then
git checkout main
git merge --no-ff todoist-stats-update
git push origin main
else
echo "No changes to merge into main"
fi
- name: Post to Slack 💬
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
INPUT_SLACK_MESSAGE: ${{ steps.todoist-stats.outputs.report }}
INPUT_CHANNEL_ID: 'C040ZLS7P2P'
name: 'Todoist Readme'
author: Abhishek Naidu
description: '🚧 Updates README with your Todoist stats'

inputs:
TODOIST_API_KEY:
description: 'Your Todoist API Key'
required: true

USERNAME:
description: 'Your GitHub username'
default: ${{ github.repository_owner }}
required: false

PREMIUM:
description: 'Premium User or Not'
default: false
required: false

runs:
using: "node12"
main: "dist/index.js"

branding:
icon: "activity"
color: "red"

0 comments on commit 50d39d0

Please sign in to comment.