Git Product home page Git Product logo

agent-action's Introduction

RelativeCI agent

GitHub action that sends bundle stats and CI build information to RelativeCI.

Other agents


  1. Usage
  1. Inputs
  2. Secrets

Usage

View action.yml

push/pull_request events

# .github/workflow/node.js.yml
name: Node.js CI

on:
  push:
    branches:
      - master
  pull_request:

jobs:
  build:
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '18.x'

      # Install dependencies
      - run: npm ci

      # Build and output bundle stats
      # see https://relative-ci.com/documentation/setup/agent/github-action/#step-1-output-bundle-stats-json-file
      - run: npm run build -- --json webpack-stats
      
      - name: Send bundle stats to RelativeCI
        uses: relative-ci/agent-action@v2
        with:
          key: ${{ secrets.RELATIVE_CI_KEY }}
          token: ${{ secrets.GITHUB_TOKEN }}
          webpackStatsFile: ./webpack-stats.json

workflow_run events

Read more about workflows triggered by forked repositories.

Build and upload bundle stats artifacts using relative-ci/agent-upload-artifact-action

# .github/workflows/build.yaml
name: Build

on:
  push:
    branches:
      - master
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '18.x'

      # Install dependencies
      - run: npm ci

      # Build and output bundle stats to webpack-stats.json
      - run: npm run build --json webpack-stats.json

      # Upload webpack-stats.json to use on relative-ci.yaml workflow
      - name: Upload bundle stats artifact
        uses: relative-ci/agent-upload-artifact-action@v1
        with:
          webpackStatsFile: ./webpack-stats.json

Send bundle stats and build information to RelativeCI

The workflow runs securely in the default branch context(ex: main). relative-ci/agent-action uses the build information (commit, message, branch) corresponding to the commit that triggerd the Build workflow.

# .github/workflows/relative-ci.yaml
name: RelativeCI

on:
  workflow_run:
    workflows: ["Build"]
    types:
      - completed

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Send bundle stats and build information to RelativeCI
        uses: relative-ci/agent-action@v2
        with:
          key: ${{ secrets.RELATIVE_CI_KEY }}
          token: ${{ secrets.GITHUB_TOKEN }}

Inputs

key

Required RelativeCI project key

token

Required GitHub token

webpackStatsFile

Required (only when running during push or pull_request events) Path to the bundle stats file

Optional

slug

Default: GITHUB_REPOSITORY evironment variable

Your project slug

includeCommitMessage

Default: true

Fetch commit message from GitHub when the context commit is different that the commit that triggered the workflow (eg: pull_request event).

debug

Default: false

Enable debug output

artifactName

Default: relative-ci-artifacts when running during workflow_run event

The name of the artifact that containts the bundle stats uploaded by the triggering workflow

Secrets

RELATIVE_CI_KEY

Your RelativeCI project key

agent-action's People

Contributors

dependabot[bot] avatar vio avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

powerm4

agent-action's Issues

HttpError: Resource not accessible by integration

I have set up the integration on Github, and the RELATIVE_CI_KEY is in the github environment variables. This is a private repository, and GITHUB_TOKEN is not in Actions environment variables because it should be implicit.

Run relative-ci/agent-action@v[2](https://github.com/ArvistDev/arvist-stack/actions/runs/8209974397/job/22456730989#step:2:2)
  with:
    key: ***
    token: ***
    includeCommitMessage: true
    debug: false
Error: HttpError: Resource not accessible by integration
name: RelativeCI
 
on:
  workflow_run:
    workflows: ["Playwright Tests"]
    types:
      - completed
 
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Send bundle stats and build information to RelativeCI
        uses: relative-ci/agent-action@v2
        with:
          key: ${{ secrets.RELATIVE_CI_KEY }}
          token: ${{ secrets.GITHUB_TOKEN }}

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.