rewrite: canvas.py Phase 2-A — constants, init attrs, simple methods #76
Workflow file for this run
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: discord-notify | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: [main] | |
| jobs: | |
| notify: | |
| if: | | |
| github.event.pull_request.merged == true && | |
| contains(github.event.pull_request.labels.*.name, 'feature') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Send to Discord | |
| env: | |
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
| PR_TITLE: ${{ github.event.pull_request.title }} | |
| PR_BODY: ${{ github.event.pull_request.body }} | |
| run: | | |
| if [[ -z "$DISCORD_WEBHOOK" ]]; then | |
| echo "Error: DISCORD_WEBHOOK secret not configured" | |
| exit 1 | |
| fi | |
| TYPE="🎉 **New feature merged!** Try it in the next release" | |
| COLOR=3066993 | |
| MILESTONE="${{ github.event.pull_request.milestone.title }}" | |
| if [[ -z "$MILESTONE" ]]; then | |
| MILESTONE="None" | |
| fi | |
| TITLE_ESCAPED=$(echo "$PR_TITLE" | jq -Rs '.[:-1]') | |
| BODY_ESCAPED=$(echo "$PR_BODY" | jq -Rs '.[:-1] | if . == "" then "No description provided" elif length > 2000 then .[0:1997] + "..." else . end') | |
| curl -fsS -X POST "$DISCORD_WEBHOOK" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{ | |
| \"content\": \"$TYPE\", | |
| \"embeds\": [{ | |
| \"title\": $TITLE_ESCAPED, | |
| \"url\": \"${{ github.event.pull_request.html_url }}\", | |
| \"color\": $COLOR, | |
| \"fields\": [ | |
| { | |
| \"name\": \"Pull request\", | |
| \"value\": \"[#${{ github.event.pull_request.number }}](${{ github.event.pull_request.html_url }})\", | |
| \"inline\": true | |
| }, | |
| { | |
| \"name\": \"Milestone\", | |
| \"value\": \"$MILESTONE\", | |
| \"inline\": true | |
| }, | |
| { | |
| \"name\": \"💬 Feedback\", | |
| \"value\": \"[Share your thoughts](https://github.com/wkentaro/labelme/discussions)\", | |
| \"inline\": true | |
| } | |
| ], | |
| \"footer\": { | |
| \"text\": $BODY_ESCAPED | |
| } | |
| }] | |
| }" |