Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing metadata #11

Merged
merged 5 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure how to integration test the action without real endpoints.

# 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:
Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't even notice this file before.

'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) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this was causing it to return the else condition to the Action runner so it was falling even though the ticket was created.

return {
success: true,
data: result.data
}
} else {
return {
success: false,
result
data: result.data
Copy link
Member Author

Choose a reason for hiding this comment

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

I think result was causing an error because the Axios response is circular.

}
}
}
Expand Down
Loading