Bump http-proxy-middleware from 2.0.6 to 2.0.7 #1332
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: PR Commands | |
on: | |
issue_comment: | |
types: [created, edited] | |
jobs: | |
report: | |
if: ${{ github.event.issue.pull_request && contains(github.event.issue.labels.*.name, 'new theme') }} | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo "On PR #$NUM @$ACTOR commented:" | |
echo "$BODY" | |
echo "==============================" | |
echo "PR original body:" | |
echo "$PRBODY" | |
echo "==============================" | |
echo "PR JSON:" | |
echo "$PR_JSON" | |
env: | |
PR_JSON: ${{ toJSON(github.event.issue.pull_request) }} | |
ACTOR: ${{ github.actor }} | |
NUM: ${{ github.event.issue.number }} | |
BODY: ${{ github.event.comment.body }} | |
PRBODY: ${{ github.event.issue.body }} | |
update-theme: | |
if: ${{ github.event.issue.pull_request && contains(github.event.issue.labels.*.name, 'new theme') && contains(github.event.comment.body, '!update') }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get head branch | |
uses: eficode/resolve-pr-refs@v0.0.4 | |
id: branch | |
with: | |
token: ${{ github.token }} | |
- name: Checkout | |
uses: actions/checkout@v2.7.0 | |
with: | |
ref: ${{ steps.branch.outputs.head_ref }} | |
- name: Read body | |
id: parse | |
uses: edumserrano/github-issue-forms-parser@v1 | |
with: | |
template-filepath: .github/ISSUE_TEMPLATE/new-theme.yml | |
issue-form-body: ${{ github.event.issue.body }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Extract command parameters | |
id: extractcmd | |
run: | | |
ONELINE_MATCH="$(grep -m1 -P '^!update [A-Za-z0-9]([A-Za-z_.-]*[A-Za-z0-9])? [A-Za-z"\[]([A-Za-z_#\[\],"-]*[A-Za-z0-9"\]])?$' <<< "$BODY")" && echo "err=false" >> "$GITHUB_OUTPUT" || echo "err=true" >> "$GITHUB_OUTPUT" | |
MATCH="$(tr ' ' '\n' <<< "$ONELINE_MATCH")" | |
echo "prop=$(head -n2 <<< "$MATCH" | tail -n1)" >> "$GITHUB_OUTPUT" | |
echo "good=$(tail -n1 <<< "$MATCH")" >> "$GITHUB_OUTPUT" | |
set | |
env: | |
BODY: ${{ github.event.comment.body }} | |
- name: Report error | |
if: ${{ steps.extractcmd.outputs.err == 'true' }} | |
run: | | |
gh pr comment ${{ github.event.issue.number }} --body '❌ Could not find the update data. Type `!help update-theme` to get help.' | |
exit 1 | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Make the change | |
id: change | |
run: | | |
node scripts/add-new-theme.cjs "$(jq <<< "$THEMEINFO" ".$PROP=$GOOD")" | |
echo '==============================' | |
cat themes.new.json | jq --tab . | tee src/themes.json | |
env: | |
THEMEINFO: ${{ steps.parse.outputs.parsed-issue }} | |
PROP: ${{ steps.extractcmd.outputs.prop }} | |
GOOD: ${{ steps.extractcmd.outputs.good }} | |
- name: Configure Git | |
id: gitconfig | |
run: | | |
git config --global user.name "$GNAME" | |
git config --global user.email "$GEMAIL" | |
env: | |
GNAME: ${{ github.actor }} | |
GEMAIL: ${{ github.actor }}@users.noreply.github.com | |
- name: Commit and push | |
id: commit | |
run: | | |
git add src/themes.json | |
git commit -m"Update $PROP to $GOOD" | |
git push | |
env: | |
PROP: ${{ steps.extractcmd.outputs.prop }} | |
GOOD: ${{ steps.extractcmd.outputs.good }} | |
- name: Report error | |
if: ${{ failure() }} | |
run: | | |
if [ "$CHANGE" = failure ]; then | |
gh issue comment ${{ github.event.issue.number }} --body '❌ An error occured while doing the change.' | |
elif [ "$GITCONFIG" = failure ]; then | |
gh issue comment ${{ github.event.issue.number }} --body '❌ An internal error occured while configuring Git.' | |
elif [ "$COMMIT" = failure ]; then | |
gh issue comment ${{ github.event.issue.number }} --body '❌ An internal error occured while commiting the changes.' | |
else | |
gh issue comment ${{ github.event.issue.number }} --body '❌ An internal error occured.' | |
fi | |
env: | |
CHANGE: ${{ steps.change.conclusion }} | |
CHLOGS: ${{ steps.change.logs }} | |
GITCONFIG: ${{ steps.gitconfig.conclusion }} | |
GCLOGS: ${{ steps.gitconfig.logs }} | |
COMMIT: ${{ steps.commit.conclusion }} | |
COMMIT_LOGS: ${{ steps.commit.logs }} | |
PROP: ${{ steps.extractcmd.outputs.prop }} | |
GH_TOKEN: ${{ github.token }} | |
- name: Comment on PR | |
run: | | |
gh pr comment ${{ github.event.issue.number }} --body "🎉 Updated \`$PROP\` successfully 👏" | |
env: | |
PROP: ${{ steps.extractcmd.outputs.prop }} | |
GH_TOKEN: ${{ github.token }} | |
update-theme-help: | |
if: ${{ github.event.issue.pull_request && contains(github.event.issue.labels.*.name, 'new theme') && contains(github.event.comment.body, '!help update-theme') }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2.7.0 | |
- name: Comment on PR | |
run: | | |
gh pr comment ${{ github.event.issue.number }} --body "$BODY" | |
env: | |
BODY: | | |
Welcome, @${{ github.actor }}. | |
The `!update` command can be used as following: | |
``` | |
!update <PROPERTY NAME> <NEW VALUE> | |
``` | |
Here are the property names: | |
Field | Property name | |
---------------------------------- | ------------------ | |
Internal name | `name` | |
Full name | `fullName` | |
Background color | `bgcolor` | |
Color | `color` | |
Light square color - NORMAL | `lscolor` | |
Light square color - SELECTED | `lscolor-selected` | |
Light square color - POSSIBLE MOVE | `lscolor-canmove` | |
Dark square color - NORMAL | `dscolor` | |
Dark square color - SELECTED | `dscolor-selected` | |
Dark square color - POSSIBLE MOVE | `dscolor-canmove` | |
GH_TOKEN: ${{ github.token }} |