Skip to content

Latest commit

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Shipyard Github Action

GitHub LicenseGithub Action Community

Use Github Action to run jobs on ephemeral environments automatically deployed by Shipyard, authenticating into them via a bypass token. This job connects with Shipyard during a Github Action job, fetching necessary environment variables in order to run e2e tests where authentication via OAuth is normally required.

How to use

In your Github Workflow file located in .github/workflows/, you can use the Shipyard's Github Action as per the following example:

on: [pull_request]
jobs:
cypress-e2e-tests:
runs-on: ubuntu-latest
name: Collect the bypass token and URL for an authenticated ephemeral environment attached to this PR in order to run e2e tests on it.
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Shipyard Tokens
uses: shipyard/github-action/fetch-shipyard-env@1.0.0
env:
SHIPYARD_API_TOKEN: ${{ secrets.SHIPYARD_API_TOKEN }}
- name: Run the e2e tests on the ephemeral environment
run: npm run test
shell: bash
env:
CYPRESS_BASE_URL: $SHIPYARD_ENVIRONMENT_URL
CYPRESS_BYPASS_TOKEN: $SHIPYARD_BYPASS_TOKEN

The Github Action can be configured by passing inputs or environment variables:

Inputs

 - name: Fetch Shipyard Tokens
uses: shipyard/github-action/fetch-shipyard-env@1.0.0
with:
api-token: ${{ secrets.SHIPYARD_API_TOKEN }}
timeout-minutes: 30
Input nameDescriptionDefault Value
api-tokenToken required to connect to Shipyard's APIs. Can be obtained from your Organization's setting page-
timeout-minutesNumber of minutes to wait for Shipyard environment before timing out.60
app-nameFilter the environments by name of the application on the Shipyard app.-

Environment Variables

 - name: Fetch Shipyard Tokens
uses: shipyard/github-action/fetch-shipyard-env@1.0.0
env:
SHIPYARD_API_TOKEN: ${{ secrets.SHIPYARD_API_TOKEN }}
SHIPYARD_TIMEOUT: 30
INPUT_APP_NAME: 'react-app'
Environment VariableDescriptionDefault Value
SHIPYARD_API_TOKENToken required to connect to Shipyard's APIs. Can be obtained from your Organization's setting page-
SHIPYARD_TIMEOUTNumber of minutes to wait for Shipyard environment before timing out.60
SHIPYARD_APP_NAMEFilter the environments by name of the application on the Shipyard app.-

NOTE: Inputs are given precedence over environment variables.

If input api-token or environment variable SHIPYARD_API_TOKEN is not provided, error is raised.

On successful run, the following environment variables are set, which can then be passed on to other actions in the same workflow.

Parameter NameDescription
SHIPYARD_ENVIRONMENT_URLURL of the ephemeral environment
SHIPYARD_ENVIRONMENT_IDID of the ephemeral environment
SHIPYARD_BYPASS_TOKENToken to bypass authentication

Resources

Shipyard Documentation

About

Github Action to fetch Shipyard environment variables

Resources

Stars

5 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages