Skip to content

每月存档

每月存档 #6

Workflow file for this run

name: 每月存档
on:
workflow_dispatch:
schedule:
- cron: '0 0 1 * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@main
- name: Create archive directory
run: |
if [ ! -d "archive" ]; then
mkdir archive
fi
- name: Set timestamp
id: timestamp
run: echo "::set-output name=timestamp::$(date +'%Y-%m')"
- name: Create archive
run: tar -czvf "archive/monthly_archive_${{ steps.timestamp.outputs.timestamp }}.tar.gz" hotlist/*.csv
- name: Delete original data
run: rm -rf hotlist/*.csv
- name: Git add and commit
run: |
git config --global user.email "[email protected]"
git config --global user.name "archiver actioner"
git add .
git commit -m "monthly_archive_${{ steps.timestamp.outputs.timestamp }}"
git push