cloudflare pages钉钉通知

开始

我的纯静态网站博客关于我笔记等网站都使用Cloudflare Pages进行编译和部署

但我发现Cloudflare没有集成通知功能,无论是编译完成还是失败,我都无法及时获知

随后我在网上查找类似功能,找到了cloudflare-pages-slack-notification

但测试后发现它不支持钉钉webhook,因此我基于该仓库进行了二次开发并翻译

项目地址

配置

github

原理是github的workflows自动检测cf的状态来推送

name: dingding_webhook
on: push
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Await CF Pages and send Slack notification
        id: cf-pages
        uses: buyfakett/cloudflare-pages-dingding-webhook@v2
        with:
          # Uncomment these two lines if you wish to use the Global API Key (Not recommended!)
          # accountEmail: ${{ secrets.CF_ACCOUNT_EMAIL  }}
          # apiKey: ${{ secrets.CF_API_KEY  }}

          # Use an API token (Recommended!)
          apiToken: ${{ secrets.CF_API_TOKEN }}
          accountId: ${{ secrets.CF_ACC_ID  }}
          # CloudFlare Pages project name
          project: ${{ secrets.CF_PAGES_PROJECT  }}
          dingWebHookKey: ${{ secrets.DING_WEBHOOK_KEY }}
          # Add this if you want GitHub Deployments (see below)
          githubToken: ${{ secrets.GITHUB_TOKEN }}

机密说明

CF_API_TOKEN: Cloudflare API 令牌。如何创建 Cloudflare API 令牌

CF_ACC_ID: CloudFlare 帐户 ID。(访问 Cloudflare 的仪表板,您将在 URL 中找到帐户 ID)

CF_PAGES_PROJECT: CloudFlare Pages 项目名称。(你可以在这里 找到它)

DING_WEBHOOK_KEY: 钉钉中创建WEBHOOK机器人, 关键字填入项目

通知截图