Skip to content

Move Draft Articles #17

Move Draft Articles

Move Draft Articles #17

Workflow file for this run

name: Move Draft Articles
on:
schedule:
# Chaque jour à 12h (10h UTC)
- cron: '0 10 * * 1-5'
permissions:
contents: write
jobs:
move_article:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Move one article from _drafts to new_posts
run: |
FILE=$(ls _drafts | head -n 1)
if [ -n "$FILE" ]; then
mv "_drafts/$FILE" "new_posts/$FILE"
else
echo "No articles left to move."
fi
- name: Commit and push changes
run: |
git config --global user.name 'GitHub Action'
git config --global user.email 'action@github.com'
git add .
git commit -m "Moved an article to new_posts"
git push