Genshin Repository List Automation #824
This file contains hidden or 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: Genshin Repository List Automation | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: 0 17 * * * | |
jobs: | |
action-preparation: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Check Git | |
run: | | |
git --version | |
auto-fetching: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Save Current Date To GitHub Environment | |
run: | | |
echo "CURRENT_DATE=$(date +'%Y-%m-%d-%H-%M-%S')" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Fetch API Data Action To Original Directory | |
uses: JamesIves/fetch-api-data-action@v2 | |
with: | |
endpoint: "https://sg-hyp-api.hoyoverse.com/hyp/hyp-connect/api/getGamePackages?game_ids[]=gopR6Cufr3&launcher_id=VYTpXlbWo8" | |
save-location: "fetch/original/" | |
save-name: result-${{ env.CURRENT_DATE }} | |
# | | |
# with: | |
# endpoint: "https://sdk-os-static.mihoyo.com/hk4e_global/mdk/launcher/api/resource?channel_id=1&key=gcStgarh&launcher_id=10&sub_channel_id=0" | |
# save-location: "fetch/original/" | |
# save-name: result-${{ env.CURRENT_DATE }} | |
- name: Fetch API Data Action To Prettier Directory | |
uses: JamesIves/fetch-api-data-action@v2 | |
with: | |
endpoint: "https://sg-hyp-api.hoyoverse.com/hyp/hyp-connect/api/getGamePackages?game_ids[]=gopR6Cufr3&launcher_id=VYTpXlbWo8" | |
save-location: "fetch/prettier/" | |
save-name: result-${{ env.CURRENT_DATE }} | |
# | | |
# with: | |
# endpoint: "https://sdk-os-static.mihoyo.com/hk4e_global/mdk/launcher/api/resource?channel_id=1&key=gcStgarh&launcher_id=10&sub_channel_id=0" | |
# save-location: "fetch/prettier/" | |
# save-name: result-${{ env.CURRENT_DATE }} | |
- name: Code File Prettier | |
run: | | |
npx prettier --write fetch/prettier/**/*.json | |
- name: Commit Changes | |
run: | | |
git config --local user.name "JRSKelvin" | |
git config --local user.email "[email protected]" | |
arr[0]="Daily Fetch Commit Automation (Bot) 🏠" | |
arr[1]="Daily Fetch Commit Automation (Bot) 🏘️" | |
arr[2]="Daily Fetch Commit Automation (Bot) 🏡" | |
arr[3]="Daily Fetch Commit Automation (Bot) 🏨" | |
arr[4]="Daily Fetch Commit Automation (Bot) 🏪" | |
arr[5]="Daily Fetch Commit Automation (Bot) 🏦" | |
arr[6]="Daily Fetch Commit Automation (Bot) 🏢" | |
arr[7]="Daily Fetch Commit Automation (Bot) 🏭" | |
rand=$[$RANDOM % ${#arr[@]}] | |
git add ./fetch/ | |
git commit -m "${arr[$rand]}" | |
- name: GitHub Push | |
uses: ad-m/[email protected] | |
with: | |
directory: "." | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |