Skip to content

Commit

Permalink
Merge pull request #4 from hhimanshu/h2-make-api-request
Browse files Browse the repository at this point in the history
fix: update package.json to update package version
  • Loading branch information
hhimanshu authored Apr 19, 2021
2 parents c942a68 + aa91089 commit df9cbc5
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 10 deletions.
40 changes: 38 additions & 2 deletions .github/workflows/preview-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Preview CI
on: [ deployment_status ]
jobs:
staging-tests:
name: Run API tests
name: Staging Tests
if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
steps:
Expand All @@ -20,4 +20,40 @@ jobs:
- name: Test
run: yarn test:integration --ci --coverage --maxWorkers=2
env:
STAGING_URL: ${{ github.event.deployment_status.target_url }}
STAGING_URL: ${{ github.event.deployment_status.target_url }}

# We must set the commit status manually
# Reference: https://github.com/bahmutov/eleventy-example/blob/main/.github/workflows/ci.yml#L27
- name: Staging Tests ✅
if: ${{ success() }}
# set the merge commit status check
# using GitHub REST API
# see https://docs.github.com/en/rest/reference/repos#create-a-commit-status
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"context": "Staging Tests",
"state": "success",
"description": "Staging tests passed",
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}'
- name: Staging Tests 🚨
if: ${{ failure() }}
# set the merge commit status check
# using GitHub REST API
# see https://docs.github.com/en/rest/reference/repos#create-a-commit-status
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"context": "Staging Tests",
"state": "failure",
"description": "Staging tests failed",
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}'
9 changes: 1 addition & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@hhimanshu/typescript-serverless-vercel",
"version": "0.0.0-development",
"author": "hhimanshu",
"private": true,
"license": "MIT",
"scripts": {
"start": "vercel dev",
Expand Down Expand Up @@ -30,14 +31,6 @@
"release": {
"branches": [
"main"
],
"plugins": [
[
"@semantic-release/npm",
{
"npmPublish": false
}
]
]
}
}
1 change: 1 addition & 0 deletions src/integration_tests/hello.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe("Address API", () => {
return fetch(url)
.then((res) => res.text())
.then((data) => {
expect(data).toBeDefined()
expect(data).toBe(`Hello ${name}!`);
});
});
Expand Down

1 comment on commit df9cbc5

@vercel
Copy link

@vercel vercel bot commented on df9cbc5 Apr 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.