matryer / xbar

Put the output from any script or program into your macOS Menu Bar (the BitBar reboot)

Home Page:https://xbarapp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

display_title is not showing up

prathamesh-dev9 opened this issue · comments

I'm creating a simple plugin which will fetch all GitHub workflow runs and displaying them with their name with status.
But unfortunately, it is giving me error. If i'm accessing name or any other value of workflow ${workflow['name'] then plugin is working fine.

Xbar - v2.7.1-beta

Please look into this issue

image

My code is as below

#!/usr/bin/env /path_to_node_executable

const axios = require("axios");
const accessToken = "github_access_token";
const apiUrl = "https://api.github.com/repos/user_name/repo_name/actions/runs";

axios
  .get(apiUrl, {
    headers: {
      Authorization: `Bearer ${accessToken}`,
      Accept: "application/vnd.github.v3+json",
    },
  })
  .then((response) => {
    const data = response.data;
    // Filter and display the running workflows
    const runningWorkflows = data.workflow_runs.filter(
      (run) => run.status === "in_progress"
    );
    console.log(`Running Workflows (${runningWorkflows.length}):`);
    console.log("---");
    // Filter and display the completed workflows
    const completedWorkflows = data.workflow_runs.filter(
      (run) => run.status !== "in_progress"
    );

    console.log("---");
    console.log(`Completed Workflows (${completedWorkflows.length}):`);
    console.log("---");
    completedWorkflows.forEach((workflow) => {
      console.log(`${workflow["display_title"]} -> ${workflow["status"]}`);
    });
  })
  .catch((error) => {
    console.log(`Failed to fetch workflow runs. Error: ${error}`);
  });