Bing_Wallpaper_Download #622
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: Bing_Wallpaper_Download | |
on: | |
schedule: | |
- cron: "1 15 * * *" # Run daily at 00:01 KST (15:01 UTC) | |
workflow_dispatch: | |
jobs: | |
download_wallpaper: | |
runs-on: ubuntu-latest | |
env: | |
TZ: Asia/Seoul | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Fetch the complete repository history | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 # Set Node.js version to 16 | |
registry-url: https://npm.pkg.github.com/ # Set the registry URL for npm | |
- name: Cache Node.js modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm # Path to cache the Node.js modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} # Cache key based on the OS and package-lock.json | |
restore-keys: | | |
${{ runner.os }}-node- # Fallback cache keys in case the exact match is not found | |
- name: Install dependencies | |
run: npm install # Install required dependencies for the project | |
- name: Run Project | |
run: npm run start | |
- name: Configure Git user | |
run: | | |
git config --local user.email "[email protected]" # Set the Git user email | |
git config --local user.name "exposir" # Set the Git user name | |
git pull | |
git add ./ # Stage all changes in the working directory | |
git commit -m "Update wallpaper on $(date '+%Y-%m-%d %H:%M:%S %Z')" # Commit the changes with a timestamp | |
- name: Push changes to the repository | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.MY_GIT_TOKEN }} # Use the secret token for authentication | |
branch: main # Push the changes to the main branch |