Skip to content

Commit

Permalink
fix: space lookups for > 30 spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
benPearce1 authored Feb 20, 2023
2 parents 171dca5 + f14b60d commit fe321fc
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,4 @@ lib/**/*
octo
out
reports/
.idea/
29 changes: 29 additions & 0 deletions DEVELOPERS_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Building for testing

To test a branch in GitHub Actions, an updated `dist/index.js` file is required.

```
npm run build
git add dist/.
git commit -m "updating index.js"
git log -q -n 1 dist/index.js | less -F
```

From the log output take note of the commit hash and push to GitHub

In a test GitHub action you can use the branched build of the action by referencing the branch or commit hash, see [here](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsuses) for details on the `uses` syntax.

```yml
env:

steps:
# ...
- name: Await task in Octopus Deploy 🐙
uses: OctopusDeploy/await-task-action@my-branch
env:
OCTOPUS_API_KEY: ${{ secrets.API_KEY }}
OCTOPUS_URL: ${{ secrets.SERVER }}
OCTOPUS_SPACE: 'Outer Space'
with:
server_task_id: {{ steps.some_previous_deployment_step.outputs.server_tasks[0].server_task_id }}
```
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ steps:
| :----------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `task_state` | The final [TaskState](https://github.com/OctopusDeploy/api-client.ts/blob/main/src/features/serverTasks/taskState.ts) (Canceled, Failed, Success, or TimedOut) returned from Octopus, or undefined if Octopus couldn't be contacted to retrieve the state |

## Developers guide

[Developers Guide](DEVELOPERS_GUIDE.md)

## 🤝 Contributions

Contributions are welcome! :heart: Please read our [Contributing Guide](.github/CONTRIBUTING.md) for information about how to get involved in this project.
14 changes: 7 additions & 7 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"dependencies": {
"@actions/core": "^1.10.0",
"@octopusdeploy/api-client": "^2.1.4",
"@octopusdeploy/api-client": "^3.0.4",
"tmp": "^0.2.1"
},
"description": "GitHub Action to Create a Release in Octopus Deploy",
Expand Down Expand Up @@ -85,4 +85,4 @@
"test:integration": "jest --ci --reporters=default --reporters=jest-junit --testPathPattern=__tests__/integration"
},
"version": "3.0.1"
}
}
8 changes: 3 additions & 5 deletions src/api-wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InputParameters } from './input-parameters'
import { Client, resolveSpaceId, ServerTaskDetails, ServerTaskWaiter, TaskState } from '@octopusdeploy/api-client'
import { Client, resolveSpaceId, ServerTask, ServerTaskWaiter, TaskState } from '@octopusdeploy/api-client'

export interface DeploymentResult {
serverTaskId: string
Expand All @@ -17,11 +17,9 @@ export async function waitForTask(client: Client, parameters: InputParameters):
parameters.serverTaskId,
parameters.pollingInterval * 1000,
parameters.timeout * 1000,
(serverTaskDetails: ServerTaskDetails) => {
(task: ServerTask) => {
if (parameters.hideProgress !== true) {
client.info(
`waiting for task ${serverTaskDetails.Task.Id}. Status: ${serverTaskDetails.Task.State}. Progress: ${serverTaskDetails.Progress.ProgressPercentage}%`
)
client.info(`waiting for task ${task.Id}. Status: ${task.State}.`)
}
}
)
Expand Down

0 comments on commit fe321fc

Please sign in to comment.