Run @relative-ci/agent job on GitHub Actions

This page contains the setup guide for the previous version of the agent (v4). Go to agent v5 to follow the setup guide for the latest stable version.

Update configuration

Update .github/workflow/WORKFLOW_NAME.yml to run @relative-ci/agent after the build is done

.github/workflow/build.yml
name: Build
on: push
jobs:
build:
steps:
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run build --json webpack-stats.json
- name: Send webpack stats to RelativeCI
run: npx relative-ci-agent
env:
RELATIVE_CI_KEY: ${{ secrets.RELATIVE_CI_KEY }}

Run from the project root directory

Since @relative-ci/agent@v4.1.0, you can run the CLI from the project root directory using --config-dir / -c argument:

npx relative-ci-agent --config-dir packages/components

pull_request workflows

When the action is running on the pull_request event, GitHub is reporting the merge commit information:

{
branch: 'refs/pull/2377/merge',
commit: 'Merge #abc124 into #abc123'
}

To allow @relative-ci/agent to send the information corresponding to the commit that triggered the pull_request event, use RelativeCI/agent GitHub Action.

workflows triggered by forked repositories

GitHub actions do not share secrets with workflows triggered by forked repositories.

With the exception of GITHUB_TOKEN, secrets are not passed to the runner when a workflow is triggered from a forked repository. (Using encrypted secrets in a workflow)

To securely run @relative-ci/agent for builds triggered by forked repositories, use RelativeCI/agent GitHub Action.





Need help?Contact us via email, Twitter, or GitHub!