Update Auction Schedules #559
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: Update Auction Schedules | |
on: | |
schedule: | |
- cron: '0 0 * * *' # At the end of every day (00:00) | |
workflow_dispatch: # Or manually from GitHub UI | |
jobs: | |
update_json: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "18" | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set credentials | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Polkadot-Kusama Bot" | |
- name: Check for existing branch | |
run: | | |
if [[ $(git ls-remote --heads origin refs/heads/auction-schedule-update | wc -l) == "1" ]]; then | |
echo deleting existing branch | |
git push origin --delete auction-schedule-update | |
else | |
echo no existing branch found | |
fi | |
- name: Update cache | |
run: | | |
git branch auction-schedule-update | |
git checkout auction-schedule-update | |
yarn | |
yarn get:auctions | |
yarn update:auctions | |
- name: Commit, push and open new PR with changes (if any) | |
run: | | |
if [[ `git status --porcelain` ]]; then | |
git commit -a -m 'auction schedule update' | |
git push --set-upstream origin auction-schedule-update | |
gh pr create -B master -H auction-schedule-update --title 'Automated auction schedule cache update' --body 'Automated Auction Schedule Update' | |
else | |
echo No auction changes detected, skipping update. | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |