Move Draft Articles #33
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: 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 '[email protected]' | |
git add . | |
git commit -m "Moved an article to new_posts" | |
git push |