Coder Social home page Coder Social logo

arddluma / cloudflare-pages-slack-notification Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 7.0 573 KB

GitHub Action for CloudFlare Pages Slack notifications

Home Page: https://ardd.cloud/setup-cloudflare-pages-slack-notifications

License: MIT License

TypeScript 100.00%
cloudflare cloudflare-pages cloudflare-pages-slack github-actions

cloudflare-pages-slack-notification's Introduction

Typing SVG

💻Tech Stack

AWS Cloudflare Netlify Vercel Heroku DigitalOcean Shell Script Solidity Python GraphQL Terraform Docker Kubernetes

Ardian's Dev Card

📊GitHub Stats :



🏆GitHub Trophies

😂Random Dev Meme

Jokes Card


cloudflare-pages-slack-notification's People

Contributors

arddluma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cloudflare-pages-slack-notification's Issues

Using action with workflow_dispatch gives TypeError: Cannot read properties of undefined (reading 'url')

Hi,

First of all thank you for this action! Much better than waiting on Cloudflare to support hooks for sure 😄

For context: I'm running Cloudflare pages builds not just on push but also via API deployments.

I tried running this action via workflow_dispatch (https://docs.github.com/en/rest/actions/workflows#create-a-workflow-dispatch-event) on master ({"ref": "refs/heads/master"}) but I get the following after the deploy step:

Waiting for Pages to finish building...
(node:1616) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
# Now at stage: build
# Now at stage: deploy
/home/runner/work/_actions/arddluma/cloudflare-pages-slack-notification/v2.5/dist/action.js:[12](https://github.com/allfront/allfront-marketing-new/actions/runs/3372632941/jobs/5596288290#step:3:13)823
Commit: ${import_utils.context.payload.head_commit.url}
                                                   ^

TypeError: Cannot read properties of undefined (reading 'url')
    at run (/home/runner/work/_actions/arddluma/cloudflare-pages-slack-notification/v2.5/dist/action.js:12823:52)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

[BUG] Skipped Deployment Runs Indefinitely

Describe the bug
When a deployment is "skipped" by cloudflare, the action continuously runs indefinitely.

GitHub Action yml config

name: Send Slack notifications
on:
  push
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Send Slack deployment notifications
      uses: arddluma/[email protected]
      with:
        accountEmail: ${{ secrets.CF_ACCOUNT_EMAIL  }}
        apiKey: ${{ secrets.CF_API_KEY  }}
        accountId: ${{ secrets.CF_ACC_ID  }}
        project: ${{ secrets.CF_PROJECT  }}
        githubToken: ${{ secrets.GITHUB_TOKEN }}
        slackWebHook: ${{ secrets.SLACK_WEBHOOK  }}

Expected behavior
I would expect the action step to be cancelled.

[BUG] no_service error

Describe the bug

The action properly waits until the CF Pages build finishes but then shows "no_service".

GitHub Action yml config

name: Deploy

on:
  push:
    branches:
      - main

jobs:

  deploy:
    runs-on: ubuntu-latest

    steps:

      - name: Check out code
        uses: actions/checkout@v3

      - name: Await Cloudflare Pages build and send Slack notification
        uses: arddluma/[email protected]
        with:
          accountEmail: ${{ secrets.CLOUDFLARE_ACCOUNT_EMAIL }}
          apiKey: ${{ secrets.CLOUDFLARE_API_KEY }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          project: uplink-docs
          githubToken: ${{ secrets.GITHUB_TOKEN }}
          slackWebHook: ${{ secrets.SLACK_WEBHOOK_URL }}

Expected behavior
A success message

Screenshots
add github action to notify via slack · uplinkhq:docs@cc732a6 2023-01-26 13-57-08

[BUG] Use Node 20 warning

Describe the bug
When using this action, this warning appears:
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: arddluma/cloudflare-pages-slack-notification@v4. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.

Expected behavior
The action should not cause this warning to appear, by way of using Node 20.

Additional context
https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/

Always throwing error when lastState = "build"

Hello @arddluma - Great work on you CF pages slack notification action

I found an issue when using the action - Its throwing error everytime when the last state is build and it is never been success.

Here's the configurations on my yml file

trigger-slack-notification:
    runs-on: ubuntu-latest
    needs: deploy
    steps:      
      - name: Await CF Pages and send Slack notification
        uses: arddluma/cloudflare-pages-slack-notification@v2
        with:
          accountEmail: ${{ secrets.CF_ACCOUNT_EMAIL  }}
          apiKey: ${{ secrets.CF_API_KEY  }}
          accountId: ${{ secrets.CF_ACC_ID  }}
          project: ${{ secrets.CF_PAGES_PROJECT  }}
          slackWebHook: ${{ secrets.SLACK_WEBHOOK_URL  }}

Is there anything that I missed on the configuration? Is this something that you noticed?

Some warnings from the package

Hello @arddluma

The package return these kind of warnings

  1. Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: arddluma/cloudflare-pages-slack-notification
    image

  2. The set-output command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
    image

Seems like need to update @action/core to the latest version actions/setup-node#590 actions/setup-node#589

Make slackWebHook optional

Is it possible to make slack messages optional? For example, we have already messages from github in our slack, but we need development env/status for PRs, github also sends messages about it to slack so a separate message is not required. But the main issue is when I delete Slack token from the action it throws an error

Wait for a specific environment or branch

Hi there,

I'm wondering if it's possible to wait for the deployment of a specific branch or environment.

Let met explain:

I have the main branch (prod) and the staging branch (staging). CF Pages deploys automatically on every commit within those branches. In my GitHub workflow I'm waiting for the deployment to be done thx to this plugin. When the deploy is done from the main branch (so in production environment), I'm sending a notif to a "production" Slack channel. And when the deploy is done from the staging branch (so in "preview" environment wrt CF terminology), I'm sending a notif to a "staging" Slack channel.

The problem is, since the plugin waits for any build to be complete and the builds often run in parallel, the notifications are sometimes sent to the wrong Slack channel, ie prod notifications to the staging channel and vice versa.

If I could specify for which branch I want to wait for the build being complete, it would solve my issue. Alternatively it would also work if I can tell the plugin to wait for a build in the "production" env to be complete vs the "preview" env.

Is there a way to achieve this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.