Skip to content

CCBot mod: Boki Colors #54

CCBot mod: Boki Colors

CCBot mod: Boki Colors #54

Workflow file for this run

name: Fill CCBot PR info
permissions:
contents: write
pull-requests: write
on:
pull_request:
types: [opened]
workflow_dispatch:
jobs:
completePR:
name: Fill CCBot PR info
runs-on: ubuntu-latest
if: startsWith(github.event.pull_request.title, 'CCBot')
steps:
- uses: actions/checkout@v4
with:
persist-credentials: true
ref: ${{ github.head_ref }}
token: ${{ secrets.PAT }}
fetch-depth: 0
- name: Find master branch
run: |
echo "MASTER_BRANCH=$(git remote show origin | awk '/HEAD branch/ {print $NF}')" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
ref: ${{ env.MASTER_BRANCH }}
persist-credentials: true
token: ${{ secrets.PAT }}
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- run: npm ci
- name: Checkout
run: |
git checkout ${{ github.head_ref }}
git checkout $MASTER_BRANCH
- name: Update the database
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: ${{ github.head_ref }}
run: |
set -e
OUT="$(npm run --silent start)"
DATA="$(echo $OUT | jq '.[]' | jq -s '.[0].metadataCCMod')"
ID="$(echo "$DATA" | jq -r '.id')"
VERSION="$(echo "$DATA" | jq -r '.version')"
TITLE="$(echo "$DATA" | jq -r '.title')"
TITLE="$(echo "$TITLE" | jq -r '.en_US' || echo $TITLE)";
DESCRIPTION="$(echo "$DATA" | jq -r '.description')"
DESCRIPTION="$(echo "$DESCRIPTION" | jq -r '.en_US' || echo $DESCRIPTION)";
echo "id: $ID"
echo "version: $VERSION"
echo "title: $TITLE"
echo "description: $DESCRIPTION"
gh pr edit "${{ github.event.pull_request.number }}" --title "CCBot mod: ${ID}"
gh pr comment "${{ github.event.pull_request.number }}" --body "Mod info:<br>${TITLE} v${VERSION}<br>${DESCRIPTION}"
echo "ID=$ID" >> $GITHUB_ENV
- name: Commit changes
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
git add -A
git commit -m "CCBot: Fill '${ID}' info"
git push