4 min read

getRepoWorkflows Documentation

Purpose

The node is designed to interact with GitHub's API to retrieve workflow run data from a specified repository. It allows users to obtain information about workflows based on various parameters such as repository owner, repository name, event type, workflow status, and conclusions. This function serves as a critical component for analytics and data platform applications that require insights into GitHub Actions workflows, enabling better monitoring and management of CI/CD processes.

Settings

1. Owner

2. Repo

3. Event

4. Status

5. Conclusion

6. Page

7. Per Page

How It Works

  1. Input Handling: The function takes inputs through the parameters inputs, config, and context. Defaults are assigned based on provided configurations if inputs are unavailable.
  2. Integration Setup: It builds a connection to the GitHub API using the utility function the integration connection. If the integration fails, the function will throw an error with an appropriate message.
  3. Input Validation: It checks for the presence of required fields (owner, repo, event, and status) and throws an error if any are missing.
  4. Data Retrieval: It calls the getWorkflowRuns method on the integration instance, passing the assembled parameters.
  5. Output: Returns the fetched data in the format { "output1": outputData }. If there is an error during the API call, it returns an error object with a message indicating the failure.

Use Cases & Examples

Use Case 1: Monitoring CI/CD Execution

A development team wants to track the success and failure rates of their CI/CD workflows triggered by code pushes to maintain software quality.

Use Case 2: Reporting Workflow Statistics

An organization needs to generate weekly reports on workflow execution results, providing insights into the efficiency and reliability of their automated processes.

Use Case 3: Triggering Alerts

An automated system can utilize this function to trigger alerts when workflows fail, enabling timely interventions.

Example Configuration

To monitor the successful workflows triggered by pushes to a repository, the configuration might look like the following:

json
{
  "inputs": {
    "owner": "my-org",
    "repo": "my-repo",
    "event": "push",
    "status": "completed",
    "conclusion": "success",
    "page": 1,
    "perPage": 50
  },
  "config": {
    "owner": "default-org",
    "repo": "default-repo",
    "event": "push",
    "status": "completed",
    "conclusion": "success",
    "page": 1,
    "perPage": 30
  },
  "context": {}
}

In this example: