GithubHelp home page GithubHelp logo

mikaelvesavuori / github-ci-demo Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 5.0 6 KB

This is a basic demonstration of what is needed to run a GitHub Actions CI build by calling their REST API.

ci ci-demo github github-actions figmagic ci-cd

github-ci-demo's Introduction

GitHub Actions CI demo through REST API

This is a basic demonstration of what is needed to run a GitHub Actions CI build by calling their REST API.

We are using Figmagic for this demo to demonstrate running it in CI. Even if you don't care for that specific tool, you'll get the gist of how to automate stuff in CI.

Instructions

Clone this repo and put it on GitHub.

Set secrets for the pipeline as per:

  • FIGMA_TOKEN as your Figma API token
  • FIGMA_URL to point to your Figma file ID

Authentication

The ideal way to authenticate is through Personal Access Tokens. Create one at the dedicated page for Personal Access Tokens.

A suitable access scope is repo.

Example call to API

Set the following headers:

  • Accept: application/vnd.github.v3+json
  • Content-Type: application/json
  • Authorization: token {YOUR_PERSONAL_ACCESS_TOKEN}

Then send a payload:

POST https://api.github.com/repos/{USER_NAME}/{REPO_NAME}/actions/workflows/{WORKFLOW_FILENAME}/dispatches

{
  "ref": "main"
}

If you want to send in inputs, the format is:

{
  "ref": "main",
  "inputs": {
    "message": "No message",
    "version": "latest"
  }
}

Only inputs that the workflow expects will be allowed. If it contains anything unexpected, the call will fail.

References

github-ci-demo's People

Contributors

mikaelvesavuori avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.