Skip to content

Commit

Permalink
Merge pull request #11 from ARPC/fix-metadata
Browse files Browse the repository at this point in the history
Fixing metadata
  • Loading branch information
jbosse authored Jul 10, 2024
2 parents b98efbb + 4981656 commit 112879b
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 35 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@ jobs:
id: npm-ci-test
run: npm run ci-test

test-action:
name: GitHub Actions Test
runs-on: ubuntu-latest
# test-action:
# name: GitHub Actions Test
# runs-on: ubuntu-latest

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
# steps:
# - name: Checkout
# id: checkout
# uses: actions/checkout@v4

- name: Test Local Action
id: test-action
uses: ./
with:
milliseconds: 1000
# - name: Test Local Action
# id: test-action
# uses: ./
# with:
# milliseconds: 1000

- name: Print Output
id: output
run: echo "${{ steps.test-action.outputs.time }}"
# - name: Print Output
# id: output
# run: echo "${{ steps.test-action.outputs.time }}"
10 changes: 5 additions & 5 deletions __tests__/planview-client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const postMock = jest.spyOn(axios, 'post').mockImplementation()
describe('createCase', () => {
const planviewClient = new PlanviewClient('https://example.com', 'somebase64Auth')
const validResponse = {
status: 200,
status: 201,
data: {
id: 1234
}
Expand Down Expand Up @@ -79,7 +79,7 @@ describe('createCase', () => {

it('returns an error if the card is not created', async () => {
const invalidResponse = {
status: 200,
status: 201,
data: {}
}
postMock.mockImplementation((_url, _payload, _config) => {
Expand All @@ -89,10 +89,10 @@ describe('createCase', () => {
const result = await planviewClient.createCard(boardId, laneId, typeId, title, customId, pr_url)

expect(result.success).toEqual(false)
expect(result.result).toBe(invalidResponse)
expect(result.data).toBe(invalidResponse.data)
})

it('returns an error if the response is not 200', async () => {
it('returns an error if the response is not 201', async () => {
const invalidResponse = {
status: 500,
data: {}
Expand All @@ -104,7 +104,7 @@ describe('createCase', () => {
const result = await planviewClient.createCard(boardId, laneId, typeId, title, customId, pr_url)

expect(result.success).toEqual(false)
expect(result.result).toBe(invalidResponse)
expect(result.data).toBe(invalidResponse.data)
})

it('returns an error if there is an eunexpected error', async () => {
Expand Down
46 changes: 38 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,48 @@
name: 'The name of your action here'
description: 'Provide a description here'
author: 'Your name or organization here'
name: 'dependabot-tickets'
description:
'This action creates a FogBugz and AgilePlace Planview ticket for Dependabot pull requests.'
author: 'Ankura Consulting Group, LLC'

# Define your inputs here.
inputs:
milliseconds:
description: 'Your input description here'
fogbugz_api_url:
description: 'The URL of your FogBugz API'
required: true
default: '1000'
fogbugz_token:
description: 'Your FogBugz API token'
required: true
fogbugz_project:
description: 'The name of your FogBugz Project'
required: true
fogbugz_category:
description: 'The name of your FogBugz Category'
required: true
planview_api_url:
description: 'The URL of your Planview API'
required: true
planview_auth:
description: 'Your Planview API token'
required: true
planview_board_id:
description: 'The ID of your Planview Board'
required: true
planview_lane_id:
description: 'The ID of your Planview Lane to put the tickets'
required: true
planview_type_id:
description: 'The type of ticket to create'
required: true
users:
description: 'The user making the pull request. Set to "dependabot"'
required: true
default: 'dependabot'

# Define your outputs here.
outputs:
time:
description: 'Your output description here'
fogbugz_id:
description: 'The FogBugz case number created'
planview_id:
description: 'The Planview ticket id created'

runs:
using: node20
Expand Down
4 changes: 2 additions & 2 deletions dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "dependabot-tickets",
"description": "This action creates a FogBugz and AgilePlace Planview ticket for Dependabot pull requests.",
"version": "0.2.0",
"author": " Ankura Consulting Group, LLC",
"version": "0.2.1",
"author": "Ankura Consulting Group, LLC",
"private": true,
"homepage": "https://github.com/actions/javascript-action#readme",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions src/planview-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ class PlanviewClient {
}

#parseResponse(result) {
if (result.status === 200 && !!result.data.id) {
if (result.status === 201 && !!result.data.id) {
return {
success: true,
data: result.data
}
} else {
return {
success: false,
result
data: result.data
}
}
}
Expand Down

0 comments on commit 112879b

Please sign in to comment.