Skip to content

Commit

Permalink
fix: Add missing values, set id as output
Browse files Browse the repository at this point in the history
* Send trace id on error
* Add Axiom API URL
* Remove main test
  • Loading branch information
bahlo committed May 14, 2024
1 parent d4e18af commit 8f431c0
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 250 deletions.
55 changes: 47 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,52 @@ jobs:
id: checkout
uses: actions/checkout@v4

- name: Test Local Action
id: test-action
- name: Test Local Action (Minimal)
id: test-action-minimal
uses: ./
with:
axiom_datasets: ${{ secrets.AXIOM_DATASETS }}
axiom_token: ${{ secrets.AXIOM_TOKEN }}
axiom_org_id: ${{ secrets.AXIOM_ORG_ID }}
title: ${{github.event.ref}}
description: ${{ github.event.head_commit.message }}
url: 'https://example.com'
token: ${{ secrets.AXIOM_TOKEN }}
axiomApiUrl: ${{ secrets.AXIOM_API_URL }}
datasets: annotations-action-ci
type: "minimal-example"
- name: Test Local Action (Complete)
id: test-action-complete
uses: ./
with:
token: ${{ secrets.AXIOM_TOKEN }}
axiomApiUrl: ${{ secrets.AXIOM_API_URL }}
datasets: annotations-action-ci
time: "2024-01-01T00:00:00Z"
endTime: "2024-01-01T01:00:00Z"
title: "Complete example"
description: "This annotation has all the fields!"
url: "https://axiom.co"
type: "complete-example"
- name: "Install Hurl"
run: |
VERSION=4.3.0
curl --location --remote-name https://github.com/Orange-OpenSource/hurl/releases/download/$VERSION/hurl_${VERSION}_amd64.deb
sudo apt update && sudo apt install ./hurl_${VERSION}_amd64.deb
- run: |
hurl <<EOF
GET ${{ secrets.AXIOM_API_URL }}/v2/annotations/${{ steps.test-action-minimal.outputs.id }}
authorization: Bearer ${{ secrets.AXIOM_TOKEN }}
HTTP 200
[Asserts]
jsonpath "$.id" == "${{ steps.test-action-minimal.outputs.id }}"
jsonpath "$.type" == "minimal-example"
EOF
- run: |
hurl <<EOF
GET ${{ secrets.AXIOM_API_URL }}/v2/annotations/${{ steps.test-action-complete.outputs.id }}
authorization: Bearer ${{ secrets.AXIOM_TOKEN }}
HTTP 200
[Asserts]
jsonpath "$.id" == "${{ steps.test-action-complete.outputs.id }}"
jsonpath "$.time" == "2024-01-01T00:00:00.000Z"
jsonpath "$.endTime" == "2024-01-01T01:00:00.000Z"
jsonpath "$.title" == "Complete example"
jsonpath "$.description" == "This annotation has all the fields!"
jsonpath "$.url" == "https://axiom.co"
jsonpath "$.type" == "complete-example"
EOF
126 changes: 0 additions & 126 deletions __tests__/main.test.ts

This file was deleted.

25 changes: 0 additions & 25 deletions __tests__/wait.test.ts

This file was deleted.

47 changes: 32 additions & 15 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,49 @@
name: 'Axiom annotations'
name: 'Axiom annotation'
author: 'Axiom, Inc.'
description: 'Create annotations in Axiom'
author: 'axiomhq'

# Add your action's branding here. This will appear on the GitHub Marketplace.
branding:
icon: 'alert-triangle'
icon: 'message-square'
color: 'black'

# Define your inputs here.
inputs:
axiom_datasets:
description: 'Comma separated list of datasets to associate the annotations with'
axiomApiUrl:
description: 'The Axiom API URL, defaults to https://api.axiom.co'
required: false
default: ''
datasets:
description: 'Comma separated list of datasets to associate the annotation with'
required: true
axiom_token:
token:
description: 'Axiom API token'
required: true
axiom_org_id:
description: 'Axiom organization ID'
required: true
time:
description: 'The time of the annotation (defaults to now)'
required: false
default: ''
endTime:
description: 'The end time of the annotation (if set, will create a ranged annotation)'
required: false
default: ''
title:
description: 'The title of the annotation'
required: true
required: false
default: ''
description:
description: 'The description of the annotation (markdown supported)'
required: true
description: 'The description of the annotation (supports Markdown)'
required: false
default: ''
url:
description: 'The URL to link to (defaults to the GitHub action URL)'
description: 'The URL to link to (defaults to the GitHub Actions run URL)'
required: false
default: ''
type:
description: 'The type of the annotation, (e.g. production-deploy)'
required: true

outputs:
id:
description: 'The ID of the created integration'

runs:
using: node20
Expand Down
60 changes: 26 additions & 34 deletions dist/index.js

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

Loading

0 comments on commit 8f431c0

Please sign in to comment.