Skip to content

Update quest data

Update quest data #603

Workflow file for this run

name: Update quest data
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 2 * * *' # At every day 02:00(UTC).
workflow_dispatch:
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install node modules
uses: bahmutov/npm-install@v1
- name: Build
run: npm run build
- name: Lint
run: npm run lint -- --max-warnings=0
- name: Update
run: npm test -- --updateSnapshot
- name: Push Branch
if: github.ref == 'refs/heads/main'
id: push
run: |
git add .
# Do not proceed if there are no file differences
COMMIT=$(git rev-parse --verify origin/$TARGET_BRANCH || echo HEAD)
FILES_CHANGED=$(git diff-index --name-only --cached $COMMIT | wc -l)
if [[ "$FILES_CHANGED" = "0" ]]; then
echo "No file changes detected."
exit 0
fi
echo -e "---\n'poi-plugin-quest-info-2': patch\n---\n\nUpdate quest data\n" > .changeset/bot-data-update.md
git add .
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git commit --message "$COMMIT_MESSAGE"
git remote set-url origin "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY"
git push --force origin HEAD:$TARGET_BRANCH
echo "createPR=true" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
COMMIT_MESSAGE: 'chore: update quest data'
TARGET_BRANCH: 'bot/data'
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
# see https://github.com/repo-sync/pull-request
- name: Create Pull Request
if: steps.push.outputs.createPR == 'true'
uses: repo-sync/pull-request@v2
with:
destination_branch: "main"
source_branch: "bot/data" # If blank, default: triggered branch
pr_title: "chore: update quest data (${{ steps.date.outputs.date }})" # Title of pull request
pr_body: "" # Full markdown support, requires pr_title to be set
github_token: ${{ secrets.GITHUB_TOKEN }}