diff --git a/.github/actions/notification/action.yml b/.github/actions/notification/action.yml new file mode 100644 index 00000000..5d66378c --- /dev/null +++ b/.github/actions/notification/action.yml @@ -0,0 +1,77 @@ +name: Discord Notification +description: Send Discord Notification + +inputs: + TYPE: + description: "Embed Type" + required: false + TITLE: + description: "Title" + required: false + DESCRIPTION: + description: "Description" + required: false + AUTHOR_NAME: + description: "Author Name" + required: false + AUTHOR_URL: + description: "Author URL" + required: false + AUTHOR_ICON_URL: + description: "Author Icon URL" + required: false + DISCORD_WEBHOOK_URL: + description: "Discord Webhook URL" + required: true + +runs: + using: "composite" + + steps: + - name: Send Discord Notification + shell: bash + run: | + if [ "${{ inputs.TYPE }}" == "success" ]; then + COLOR=5763207 + elif [ "${{ inputs.TYPE }}" == "failure" ]; then + COLOR=15548997 + elif [ "${{ inputs.TYPE }}" == "info" ]; then + COLOR=1752301 + else + COLOR=9868950 + fi + + PAYLOAD=$(cat <> $GITHUB_ENV + command: pages deploy --branch=${{ github.event.pull_request.head.ref }} - notify_discord: - name: Notify Discord + send_result: + name: Send Result runs-on: ubuntu-latest needs: [lint, build_and_deploy] if: always() steps: - - name: Send Discord Notification - run: | - if [ "${{ needs.lint.result }}" == "failure" ]; then - STATUS="❌ Lint Failed" - COLOR=15158332 - elif [ "${{ needs.build_and_deploy.result }}" == "failure" ]; then - STATUS="❌ Build and Deploy Failed" - COLOR=15158332 - else - STATUS="✅ Build Succeeded" - COLOR=3066993 - fi - - PAYLOAD=$(cat <