Skip to content

Commit

Permalink
Sha on pull request (#31)
Browse files Browse the repository at this point in the history
* add action on pull request;  bifurcate logic for getting SHA

* prettier

* install dependencies

* fix type error

* adding pr workflow

* fix event name
  • Loading branch information
gcooney committed Dec 11, 2020
1 parent c9de8ea commit 0b85570
Show file tree
Hide file tree
Showing 4 changed files with 186 additions and 7 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/pr-workflow.yaml
@@ -0,0 +1,31 @@
on: [pull_request]
name: mabl

jobs:
test:
name: Mabl Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: Install dependencies
run: npm ci

- name: Run checks
run: npm run check

- name: Compile Typescript
run: npm run build

- name: Run Tests
run: npm test

- name: Run mabl tests against deployment
id: mabl-test-deployment
uses: ./
env:
MABL_API_KEY: ${{ secrets.MABL_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
application-id: l-j3VqIO6lLLOOEoFTPSxA-a
environment-id: rtb4kWD5LuTr2KxaHvwfaA-e
153 changes: 148 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -17,6 +17,7 @@
"author": "mabl",
"dependencies": {
"@actions/core": "^1.2.6",
"@actions/github": "^4.0.0",
"async-retry": "^1.2.3",
"axios": "^0.20.0",
"cli-table3": "^0.5.1",
Expand Down
8 changes: 6 additions & 2 deletions src/index.ts
Expand Up @@ -8,7 +8,8 @@ import {
import {Application} from './entities/Application';
import {Execution, ExecutionResult} from './entities/ExecutionResult';
import {prettyFormatExecution} from './table';
import * as core from '@actions/core/lib/core';
import * as core from '@actions/core';
import * as github from '@actions/github';
import {Option} from './interfaces';

const DEFAULT_MABL_APP_URL = 'https://app.mabl.com';
Expand Down Expand Up @@ -86,7 +87,10 @@ async function run(): Promise<void> {
}

const baseApiUrl = process.env.APP_URL ?? DEFAULT_MABL_APP_URL;
const revision = process.env.GITHUB_SHA;
const revision =
process.env.GITHUB_EVENT_NAME === 'pull_request'
? github.context.payload.pull_request?.head?.sha
: process.env.GITHUB_SHA;

core.info(`Using git revision [${revision}]`);
core.endGroup();
Expand Down

0 comments on commit 0b85570

Please sign in to comment.