Write at least one article every month #724
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: Write at least one article every month | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- run: pip install yq | |
- name: Test articles count | |
run: | | |
BLOG_ARTICLES=`curl https://hakatashi.hatenadiary.com/feed | xq '.feed.entry|map(select(.published[0:-6]+"Z"|fromdate>now-30*24*60*60))|length'` | |
echo "Blog articles written in this 30 days: $BLOG_ARTICLES" | |
QIITA_ARTICLES=`curl https://qiita.com/hakatashi/feed | xq '.feed.entry|map(select(.published[0:-6]+"Z"|fromdate>now-30*24*60*60))|length'` | |
echo "Qiita articles written in this 30 days: $QIITA_ARTICLES" | |
ARTICLES=`expr $BLOG_ARTICLES + $QIITA_ARTICLES` | |
echo "Articles written in this 30 days: $ARTICLES" | |
test $ARTICLES -gt 0 |