最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

notifications - Play sound, when Github CI is done - Stack Overflow

programmeradmin3浏览0评论

I often need to wait until Github CI is done.

I see "N in progress":

After the is done I need to do additional steps like merging the PR and incorporate the change in other tools.

I tried guessing how long the job takes, but the duration differs a lot because the job runners are sometimes used by other jobs.

How to get a notified as soon as the CI job is done?

I use Ubuntu Linux.

I often need to wait until Github CI is done.

I see "N in progress":

After the is done I need to do additional steps like merging the PR and incorporate the change in other tools.

I tried guessing how long the job takes, but the duration differs a lot because the job runners are sometimes used by other jobs.

How to get a notified as soon as the CI job is done?

I use Ubuntu Linux.

Share Improve this question asked Feb 14 at 6:52 guettliguettli 28k105 gold badges410 silver badges753 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 0

if we run some local service on PORT, which is handling playSound functionality while making POST request, then using this step we might achive sound functionality

add this step at the end of .xml, which would make POST request on PORT

 -name: Send Notification to Ubuntu
 run: curl -X POST http://YOUR_UBUNTU_IP:PORT

here is example of app.js doing sem

const express = require("express");
const player = require("play-sound")({});

const app = express();
const PORT = 3000;

app.use(express.json());

app.get("/",(req,res)=>{
  res.json("Hello ")
})

app.post("/play-sound", (req, res) => {
  console.log("Received a POST request, playing sound...");

  player.play("playsound.mp3", (err) => {
    if (err) {
      console.error("Error playing sound:", err);
      return res.status(500).json({ message: "Failed to play sound" });
    }
    res.json({ message: "Sound played successfully!" });
  });
});

app.listen(PORT, () => {
  console.log(`Server is running on http://localhost:${PORT}`);
});

directory structure

-node_modules
-app.js
-playsound.mp3
-package.json
..other 

I found that solution:

gh run watch; music

gh run watch gives you a list of jobs, you can select one. When it is finished, the next command is called music. Use whatever command you want for that. For me music is a small script which plays a song I like.

发布评论

评论列表(0)

  1. 暂无评论