chore(deps): bump the npm-actions-dependencies group with 3 updates

Bumps the npm-actions-dependencies group with 3 updates:
- [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core)
- [@actions/github](https://github.com/actions/toolkit/tree/HEAD/packages/github)
- [@actions/tool-cache](https://github.com/actions/toolkit/tree/HEAD/packages/tool-cache)

Updates `@actions/core` from 2.0.2 to 3.0.0
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Updates `@actions/github` from 7.0.0 to 9.0.0
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/github/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/github)

Updates `@actions/tool-cache` from 3.0.0 to 4.0.0
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/tool-cache/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/@actions/cache@4.0.0/packages/tool-cache)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-version: 3.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: npm-actions-dependencies
- dependency-name: "@actions/github"
  dependency-version: 9.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: npm-actions-dependencies
- dependency-name: "@actions/tool-cache"
  dependency-version: 4.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: npm-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
This commit is contained in:
dependabot[bot] 2026-01-30 04:07:16 +00:00 committed by Emilien Escalle
parent cce39442ef
commit 2ab47e7e09
24 changed files with 45692 additions and 37469 deletions

47859
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

98
dist/licenses.txt generated vendored
View File

@ -83,28 +83,6 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@fastify/busboy
MIT
Copyright Brian White. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
@octokit/auth-token
MIT
The MIT License
@ -482,25 +460,6 @@ Apache-2.0
limitations under the License.
deprecation
ISC
The ISC License
Copyright (c) Gregor Martynus and contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
docker-compose
MIT
MIT License
@ -526,24 +485,32 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
once
ISC
The ISC License
fast-content-type-parse
MIT
MIT License
Copyright (c) Isaac Z. Schlueter and Contributors
Copyright (c) 2023 The Fastify Team
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
The Fastify team members are listed at https://github.com/fastify/fastify#team
and in the README file.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
semver
ISC
@ -618,32 +585,13 @@ universal-user-agent
ISC
# [ISC License](https://spdx.org/licenses/ISC)
Copyright (c) 2018, Gregor Martynus (https://github.com/gr2m)
Copyright (c) 2018-2021, Gregor Martynus (https://github.com/gr2m)
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
wrappy
ISC
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
yaml
ISC
Copyright Eemeli Aro <eemeli@gmail.com>

3
dist/package.json generated vendored Normal file
View File

@ -0,0 +1,3 @@
{
"type": "module"
}

33217
dist/post.js generated vendored

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,3 @@
import { default as tsDevToolsCore } from "@ts-dev-tools/core/dist/eslint-plugin-ts-dev-tools/index.js";
import tsDevToolsCore from "@ts-dev-tools/core/dist/eslint-plugin-ts-dev-tools/index.js";
export default tsDevToolsCore.default;

460
package-lock.json generated
View File

@ -9,9 +9,9 @@
"version": "0.0.0",
"license": "MIT",
"dependencies": {
"@actions/core": "^2.0.2",
"@actions/github": "^7.0.0",
"@actions/tool-cache": "^3.0.0",
"@actions/core": "^3.0.0",
"@actions/github": "^9.0.0",
"@actions/tool-cache": "^4.0.0",
"@octokit/action": "^8.0.4",
"docker-compose": "^1.3.0"
},
@ -35,75 +35,86 @@
}
},
"node_modules/@actions/core": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-2.0.2.tgz",
"integrity": "sha512-Ast1V7yHbGAhplAsuVlnb/5J8Mtr/Zl6byPPL+Qjq3lmfIgWF1ak1iYfF/079cRERiuTALTXkSuEUdZeDCfGtA==",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-3.0.0.tgz",
"integrity": "sha512-zYt6cz+ivnTmiT/ksRVriMBOiuoUpDCJJlZ5KPl2/FRdvwU3f7MPh9qftvbkXJThragzUZieit2nyHUyw53Seg==",
"license": "MIT",
"dependencies": {
"@actions/exec": "^2.0.0",
"@actions/http-client": "^3.0.1"
"@actions/exec": "^3.0.0",
"@actions/http-client": "^4.0.0"
}
},
"node_modules/@actions/exec": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-2.0.0.tgz",
"integrity": "sha512-k8ngrX2voJ/RIN6r9xB82NVqKpnMRtxDoiO+g3olkIUpQNqjArXrCQceduQZCQj3P3xm32pChRLqRrtXTlqhIw==",
"license": "MIT",
"dependencies": {
"@actions/io": "^2.0.0"
}
},
"node_modules/@actions/github": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/@actions/github/-/github-7.0.0.tgz",
"integrity": "sha512-PyGODO938aoBTZd/IfN/+e+Pd5hUcVpyf+thm4CPESLeqhdSkq5QwMTGX9v84XHE1ifmHWBQ60KB8kIgm96opw==",
"license": "MIT",
"dependencies": {
"@actions/http-client": "^3.0.1",
"@octokit/core": "^5.0.1",
"@octokit/plugin-paginate-rest": "^9.2.2",
"@octokit/plugin-rest-endpoint-methods": "^10.4.0",
"@octokit/request": "^8.4.1",
"@octokit/request-error": "^5.1.1",
"undici": "^5.28.5"
}
},
"node_modules/@actions/http-client": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-3.0.1.tgz",
"integrity": "sha512-SbGS8c/vySbNO3kjFgSW77n83C4MQx/Yoe+b1hAdpuvfHxnkHzDq2pWljUpAA56Si1Gae/7zjeZsV0CYjmLo/w==",
"node_modules/@actions/core/node_modules/@actions/http-client": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-4.0.0.tgz",
"integrity": "sha512-QuwPsgVMsD6qaPD57GLZi9sqzAZCtiJT8kVBCDpLtxhL5MydQ4gS+DrejtZZPdIYyB1e95uCK9Luyds7ybHI3g==",
"license": "MIT",
"dependencies": {
"tunnel": "^0.0.6",
"undici": "^5.28.5"
"undici": "^6.23.0"
}
},
"node_modules/@actions/exec": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-3.0.0.tgz",
"integrity": "sha512-6xH/puSoNBXb72VPlZVm7vQ+svQpFyA96qdDBvhB8eNZOE8LtPf9L4oAsfzK/crCL8YZ+19fKYVnM63Sl+Xzlw==",
"license": "MIT",
"dependencies": {
"@actions/io": "^3.0.2"
}
},
"node_modules/@actions/github": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/@actions/github/-/github-9.0.0.tgz",
"integrity": "sha512-yJ0RoswsAaKcvkmpCE4XxBRiy/whH2SdTBHWzs0gi4wkqTDhXMChjSdqBz/F4AeiDlP28rQqL33iHb+kjAMX6w==",
"license": "MIT",
"dependencies": {
"@actions/http-client": "^3.0.2",
"@octokit/core": "^7.0.6",
"@octokit/plugin-paginate-rest": "^14.0.0",
"@octokit/plugin-rest-endpoint-methods": "^17.0.0",
"@octokit/request": "^10.0.7",
"@octokit/request-error": "^7.1.0",
"undici": "^6.23.0"
}
},
"node_modules/@actions/http-client": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-3.0.2.tgz",
"integrity": "sha512-JP38FYYpyqvUsz+Igqlc/JG6YO9PaKuvqjM3iGvaLqFnJ7TFmcLyy2IDrY0bI0qCQug8E9K+elv5ZNfw62ZJzA==",
"license": "MIT",
"dependencies": {
"tunnel": "^0.0.6",
"undici": "^6.23.0"
}
},
"node_modules/@actions/io": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@actions/io/-/io-2.0.0.tgz",
"integrity": "sha512-Jv33IN09XLO+0HS79aaODsvIRyduiF7NY/F6LYeK5oeUmrsz7aFdRphQjFoESF4jS7lMauDOttKALcpapVDIAg==",
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@actions/io/-/io-3.0.2.tgz",
"integrity": "sha512-nRBchcMM+QK1pdjO7/idu86rbJI5YHUKCvKs0KxnSYbVe3F51UfGxuZX4Qy/fWlp6l7gWFwIkrOzN+oUK03kfw==",
"license": "MIT"
},
"node_modules/@actions/tool-cache": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-3.0.0.tgz",
"integrity": "sha512-JBx8gEWuu8Lqaqx/hEnL6QdKvF06suBR4y+dBDi9vJbHx1r+p6QtmBKhQYhiKjDUYIoDX1bUrbyAYPChoPK+XA==",
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-4.0.0.tgz",
"integrity": "sha512-L8P9HbXvpvqjZDveb/fdsa55IVC0trfPgQ4ZwGo6r5af6YDVdM9vMGPZ7rgY2fAT9gGj4PSYd6bYlg3p3jD78A==",
"license": "MIT",
"dependencies": {
"@actions/core": "^2.0.1",
"@actions/exec": "^2.0.0",
"@actions/http-client": "^3.0.1",
"@actions/io": "^2.0.0",
"semver": "^6.1.0"
"@actions/core": "^3.0.0",
"@actions/exec": "^3.0.0",
"@actions/http-client": "^4.0.0",
"@actions/io": "^3.0.0",
"semver": "^7.7.3"
}
},
"node_modules/@actions/tool-cache/node_modules/semver": {
"version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
"node_modules/@actions/tool-cache/node_modules/@actions/http-client": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-4.0.0.tgz",
"integrity": "sha512-QuwPsgVMsD6qaPD57GLZi9sqzAZCtiJT8kVBCDpLtxhL5MydQ4gS+DrejtZZPdIYyB1e95uCK9Luyds7ybHI3g==",
"license": "MIT",
"dependencies": {
"tunnel": "^0.0.6",
"undici": "^6.23.0"
}
},
"node_modules/@ampproject/remapping": {
@ -1231,14 +1242,6 @@
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
"node_modules/@fastify/busboy": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
"integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
"engines": {
"node": ">=14"
}
},
"node_modules/@github/browserslist-config": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@github/browserslist-config/-/browserslist-config-1.0.0.tgz",
@ -1994,7 +1997,29 @@
"node": ">= 20"
}
},
"node_modules/@octokit/action/node_modules/@octokit/auth-token": {
"node_modules/@octokit/action/node_modules/undici": {
"version": "7.19.2",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.19.2.tgz",
"integrity": "sha512-4VQSpGEGsWzk0VYxyB/wVX/Q7qf9t5znLRgs0dzszr9w9Fej/8RVNQ+S20vdXSAyra/bJ7ZQfGv6ZMj7UEbzSg==",
"license": "MIT",
"engines": {
"node": ">=20.18.1"
}
},
"node_modules/@octokit/auth-action": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/@octokit/auth-action/-/auth-action-6.0.2.tgz",
"integrity": "sha512-gEBsz0QioHOMoEU7u2VMr2FfOvfJCrGc42K9rliS7LnlZJLcEMFccIiCiPpPNH+yXs7YYNKQ7lOX67ZTWn6Ysg==",
"license": "MIT",
"dependencies": {
"@octokit/auth-token": "^6.0.0",
"@octokit/types": "^16.0.0"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@octokit/auth-token": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-6.0.0.tgz",
"integrity": "sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w==",
@ -2003,7 +2028,7 @@
"node": ">= 20"
}
},
"node_modules/@octokit/action/node_modules/@octokit/core": {
"node_modules/@octokit/core": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-7.0.6.tgz",
"integrity": "sha512-DhGl4xMVFGVIyMwswXeyzdL4uXD5OGILGX5N8Y+f6W7LhC1Ze2poSNrkF/fedpVDHEEZ+PHFW0vL14I+mm8K3Q==",
@ -2022,7 +2047,7 @@
"node": ">= 20"
}
},
"node_modules/@octokit/action/node_modules/@octokit/endpoint": {
"node_modules/@octokit/endpoint": {
"version": "11.0.2",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-11.0.2.tgz",
"integrity": "sha512-4zCpzP1fWc7QlqunZ5bSEjxc6yLAlRTnDwKtgXfcI/FxxGoqedDG8V2+xJ60bV2kODqcGB+nATdtap/XYq2NZQ==",
@ -2035,7 +2060,7 @@
"node": ">= 20"
}
},
"node_modules/@octokit/action/node_modules/@octokit/graphql": {
"node_modules/@octokit/graphql": {
"version": "9.0.3",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-9.0.3.tgz",
"integrity": "sha512-grAEuupr/C1rALFnXTv6ZQhFuL1D8G5y8CN04RgrO4FIPMrtm+mcZzFG7dcBm+nq+1ppNixu+Jd78aeJOYxlGA==",
@ -2049,13 +2074,13 @@
"node": ">= 20"
}
},
"node_modules/@octokit/action/node_modules/@octokit/openapi-types": {
"node_modules/@octokit/openapi-types": {
"version": "27.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-27.0.0.tgz",
"integrity": "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA==",
"license": "MIT"
},
"node_modules/@octokit/action/node_modules/@octokit/plugin-paginate-rest": {
"node_modules/@octokit/plugin-paginate-rest": {
"version": "14.0.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-14.0.0.tgz",
"integrity": "sha512-fNVRE7ufJiAA3XUrha2omTA39M6IXIc6GIZLvlbsm8QOQCYvpq/LkMNGyFlB1d8hTDzsAXa3OKtybdMAYsV/fw==",
@ -2070,7 +2095,7 @@
"@octokit/core": ">=6"
}
},
"node_modules/@octokit/action/node_modules/@octokit/plugin-rest-endpoint-methods": {
"node_modules/@octokit/plugin-rest-endpoint-methods": {
"version": "17.0.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-17.0.0.tgz",
"integrity": "sha512-B5yCyIlOJFPqUUeiD0cnBJwWJO8lkJs5d8+ze9QDP6SvfiXSz1BF+91+0MeI1d2yxgOhU/O+CvtiZ9jSkHhFAw==",
@ -2085,10 +2110,10 @@
"@octokit/core": ">=6"
}
},
"node_modules/@octokit/action/node_modules/@octokit/request": {
"version": "10.0.6",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.6.tgz",
"integrity": "sha512-FO+UgZCUu+pPnZAR+iKdUt64kPE7QW7ciqpldaMXaNzixz5Jld8dJ31LAUewk0cfSRkNSRKyqG438ba9c/qDlQ==",
"node_modules/@octokit/request": {
"version": "10.0.7",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.7.tgz",
"integrity": "sha512-v93h0i1yu4idj8qFPZwjehoJx4j3Ntn+JhXsdJrG9pYaX6j/XRz2RmasMUHtNgQD39nrv/VwTWSqK0RNXR8upA==",
"license": "MIT",
"dependencies": {
"@octokit/endpoint": "^11.0.2",
@ -2101,251 +2126,25 @@
"node": ">= 20"
}
},
"node_modules/@octokit/action/node_modules/@octokit/request-error": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-7.0.2.tgz",
"integrity": "sha512-U8piOROoQQUyExw5c6dTkU3GKxts5/ERRThIauNL7yaRoeXW0q/5bgHWT7JfWBw1UyrbK8ERId2wVkcB32n0uQ==",
"license": "MIT",
"dependencies": {
"@octokit/types": "^16.0.0"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@octokit/action/node_modules/@octokit/types": {
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-16.0.0.tgz",
"integrity": "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^27.0.0"
}
},
"node_modules/@octokit/action/node_modules/before-after-hook": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-4.0.0.tgz",
"integrity": "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ==",
"license": "Apache-2.0"
},
"node_modules/@octokit/action/node_modules/undici": {
"version": "7.16.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.16.0.tgz",
"integrity": "sha512-QEg3HPMll0o3t2ourKwOeUAZ159Kn9mx5pnzHRQO8+Wixmh88YdZRiIwat0iNzNNXn0yoEtXJqFpyW7eM8BV7g==",
"license": "MIT",
"engines": {
"node": ">=20.18.1"
}
},
"node_modules/@octokit/action/node_modules/universal-user-agent": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz",
"integrity": "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A==",
"license": "ISC"
},
"node_modules/@octokit/auth-action": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/@octokit/auth-action/-/auth-action-6.0.2.tgz",
"integrity": "sha512-gEBsz0QioHOMoEU7u2VMr2FfOvfJCrGc42K9rliS7LnlZJLcEMFccIiCiPpPNH+yXs7YYNKQ7lOX67ZTWn6Ysg==",
"license": "MIT",
"dependencies": {
"@octokit/auth-token": "^6.0.0",
"@octokit/types": "^16.0.0"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@octokit/auth-action/node_modules/@octokit/auth-token": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-6.0.0.tgz",
"integrity": "sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w==",
"license": "MIT",
"engines": {
"node": ">= 20"
}
},
"node_modules/@octokit/auth-action/node_modules/@octokit/openapi-types": {
"version": "27.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-27.0.0.tgz",
"integrity": "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA==",
"license": "MIT"
},
"node_modules/@octokit/auth-action/node_modules/@octokit/types": {
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-16.0.0.tgz",
"integrity": "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^27.0.0"
}
},
"node_modules/@octokit/auth-token": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz",
"integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==",
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/core": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.1.0.tgz",
"integrity": "sha512-BDa2VAMLSh3otEiaMJ/3Y36GU4qf6GI+VivQ/P41NC6GHcdxpKlqV0ikSZ5gdQsmS3ojXeRx5vasgNTinF0Q4g==",
"peer": true,
"dependencies": {
"@octokit/auth-token": "^4.0.0",
"@octokit/graphql": "^7.0.0",
"@octokit/request": "^8.0.2",
"@octokit/request-error": "^5.0.0",
"@octokit/types": "^12.0.0",
"before-after-hook": "^2.2.0",
"universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/endpoint": {
"version": "9.0.6",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.6.tgz",
"integrity": "sha512-H1fNTMA57HbkFESSt3Y9+FBICv+0jFceJFPWDePYlR/iMGrwM5ph+Dd4XRQs+8X+PUFURLQgX9ChPfhJ/1uNQw==",
"license": "MIT",
"dependencies": {
"@octokit/types": "^13.1.0",
"universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/endpoint/node_modules/@octokit/openapi-types": {
"version": "24.2.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
"integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
"license": "MIT"
},
"node_modules/@octokit/endpoint/node_modules/@octokit/types": {
"version": "13.10.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
"integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^24.2.0"
}
},
"node_modules/@octokit/graphql": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.0.2.tgz",
"integrity": "sha512-OJ2iGMtj5Tg3s6RaXH22cJcxXRi7Y3EBqbHTBRq+PQAqfaS8f/236fUrWhfSn8P4jovyzqucxme7/vWSSZBX2Q==",
"dependencies": {
"@octokit/request": "^8.0.1",
"@octokit/types": "^12.0.0",
"universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/openapi-types": {
"version": "20.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz",
"integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA=="
},
"node_modules/@octokit/plugin-paginate-rest": {
"version": "9.2.2",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.2.tgz",
"integrity": "sha512-u3KYkGF7GcZnSD/3UP0S7K5XUFT2FkOQdcfXZGZQPGv3lm4F2Xbf71lvjldr8c1H3nNbF+33cLEkWYbokGWqiQ==",
"license": "MIT",
"dependencies": {
"@octokit/types": "^12.6.0"
},
"engines": {
"node": ">= 18"
},
"peerDependencies": {
"@octokit/core": "5"
}
},
"node_modules/@octokit/plugin-rest-endpoint-methods": {
"version": "10.4.1",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz",
"integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==",
"dependencies": {
"@octokit/types": "^12.6.0"
},
"engines": {
"node": ">= 18"
},
"peerDependencies": {
"@octokit/core": "5"
}
},
"node_modules/@octokit/request": {
"version": "8.4.1",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.1.tgz",
"integrity": "sha512-qnB2+SY3hkCmBxZsR/MPCybNmbJe4KAlfWErXq+rBKkQJlbjdJeS85VI9r8UqeLYLvnAenU8Q1okM/0MBsAGXw==",
"license": "MIT",
"dependencies": {
"@octokit/endpoint": "^9.0.6",
"@octokit/request-error": "^5.1.1",
"@octokit/types": "^13.1.0",
"universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/request-error": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz",
"integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==",
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-7.1.0.tgz",
"integrity": "sha512-KMQIfq5sOPpkQYajXHwnhjCC0slzCNScLHs9JafXc4RAJI+9f+jNDlBNaIMTvazOPLgb4BnlhGJOTbnN0wIjPw==",
"license": "MIT",
"dependencies": {
"@octokit/types": "^13.1.0",
"deprecation": "^2.0.0",
"once": "^1.4.0"
"@octokit/types": "^16.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/request-error/node_modules/@octokit/openapi-types": {
"version": "24.2.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
"integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
"license": "MIT"
},
"node_modules/@octokit/request-error/node_modules/@octokit/types": {
"version": "13.10.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
"integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^24.2.0"
}
},
"node_modules/@octokit/request/node_modules/@octokit/openapi-types": {
"version": "24.2.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
"integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
"license": "MIT"
},
"node_modules/@octokit/request/node_modules/@octokit/types": {
"version": "13.10.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
"integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^24.2.0"
"node": ">= 20"
}
},
"node_modules/@octokit/types": {
"version": "12.6.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz",
"integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==",
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-16.0.0.tgz",
"integrity": "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^20.0.0"
"@octokit/openapi-types": "^27.0.0"
}
},
"node_modules/@oxc-parser/binding-android-arm64": {
@ -5195,9 +4994,10 @@
"dev": true
},
"node_modules/before-after-hook": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
"integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-4.0.0.tgz",
"integrity": "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ==",
"license": "Apache-2.0"
},
"node_modules/brace-expansion": {
"version": "2.0.2",
@ -5912,11 +5712,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/deprecation": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
"integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ=="
},
"node_modules/detect-newline": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz",
@ -9788,6 +9583,7 @@
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dev": true,
"dependencies": {
"wrappy": "1"
}
@ -10563,10 +10359,9 @@
}
},
"node_modules/semver": {
"version": "7.7.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz",
"integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",
"dev": true,
"version": "7.7.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz",
"integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==",
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
@ -11457,15 +11252,12 @@
}
},
"node_modules/undici": {
"version": "5.29.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz",
"integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==",
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.23.0.tgz",
"integrity": "sha512-VfQPToRA5FZs/qJxLIinmU59u0r7LXqoJkCzinq3ckNJp3vKEh7jTWN589YQ5+aoAC/TGRLyJLCPKcLQbM8r9g==",
"license": "MIT",
"dependencies": {
"@fastify/busboy": "^2.0.0"
},
"engines": {
"node": ">=14.0"
"node": ">=18.17"
}
},
"node_modules/undici-types": {
@ -11489,9 +11281,10 @@
}
},
"node_modules/universal-user-agent": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz",
"integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ=="
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz",
"integrity": "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A==",
"license": "ISC"
},
"node_modules/unrs-resolver": {
"version": "1.11.1",
@ -11808,7 +11601,8 @@
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"dev": true
},
"node_modules/write-file-atomic": {
"version": "4.0.2",

View File

@ -6,6 +6,7 @@
"license": "MIT",
"homepage": "https://github.com/hoverkraft-tech/compose-action",
"private": true,
"type": "module",
"repository": {
"type": "git",
"url": "git+https://github.com/hoverkraft-tech/compose-action.git"
@ -24,9 +25,9 @@
"node": ">=20"
},
"dependencies": {
"@actions/core": "^2.0.2",
"@actions/github": "^7.0.0",
"@actions/tool-cache": "^3.0.0",
"@actions/core": "^3.0.0",
"@actions/github": "^9.0.0",
"@actions/tool-cache": "^4.0.0",
"@octokit/action": "^8.0.4",
"docker-compose": "^1.3.0"
},
@ -46,18 +47,20 @@
"all": "npm run format && npm run lint:ci && npm run test:ci && npm run package",
"build": "tsc --noEmit",
"format": "prettier --cache --write .",
"jest": "jest --detectOpenHandles --forceExit",
"test": "npm run jest -- --maxWorkers=50%",
"test:watch": "npm run jest --watch -- --maxWorkers=25%",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --detectOpenHandles --forceExit --maxWorkers=50%",
"test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch --maxWorkers=25%",
"test:cov": "npm run test -- --coverage",
"test:ci": "npm run jest -- --coverage --runInBand",
"test:ci": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage --runInBand --detectOpenHandles --forceExit",
"prepare": "ts-dev-tools install"
},
"jest": {
"preset": "ts-jest",
"preset": "ts-jest/presets/default-esm",
"verbose": true,
"clearMocks": true,
"testEnvironment": "node",
"extensionsToTreatAsEsm": [
".ts"
],
"moduleFileExtensions": [
"js",
"ts"
@ -71,9 +74,19 @@
"/node_modules/",
"/dist/"
],
"transform": {
"^.+\\.ts$": "ts-jest"
"moduleNameMapper": {
"^(\\.{1,2}/.*)\\.js$": "$1"
},
"transform": {
"^.+\\.ts$": [
"ts-jest",
{
"useESM": true,
"tsconfig": "tsconfig.json"
}
]
},
"injectGlobals": true,
"coverageReporters": [
"json-summary",
"text",

View File

@ -1,15 +1,46 @@
import * as core from "@actions/core";
import { InputService } from "./services/input.service";
import { LoggerService, LogLevel } from "./services/logger.service";
import { DockerComposeInstallerService } from "./services/docker-compose-installer.service";
import * as indexRunner from "./index-runner";
import { DockerComposeService } from "./services/docker-compose.service";
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
// Mock @actions/core
const setFailedMock = jest.fn();
jest.unstable_mockModule("@actions/core", () => ({
setFailed: setFailedMock,
getInput: jest.fn().mockReturnValue(""),
getMultilineInput: jest.fn().mockReturnValue([]),
debug: jest.fn(),
info: jest.fn(),
warning: jest.fn(),
}));
// Mock docker-compose
jest.unstable_mockModule("docker-compose", () => ({
upAll: jest.fn(),
upMany: jest.fn(),
down: jest.fn(),
logs: jest.fn(),
version: jest
.fn<() => Promise<{ data: { version: string } }>>()
.mockResolvedValue({ data: { version: "1.2.3" } }),
}));
// Mock node:fs
jest.unstable_mockModule("node:fs", () => ({
existsSync: jest.fn().mockReturnValue(true),
default: { existsSync: jest.fn().mockReturnValue(true) },
}));
// Dynamic imports after mock setup
const { run } = await import("./index-runner.js");
const { InputService } = await import("./services/input.service.js");
const { LoggerService, LogLevel } = await import("./services/logger.service.js");
const { DockerComposeInstallerService } = await import(
"./services/docker-compose-installer.service.js"
);
const { DockerComposeService } = await import("./services/docker-compose.service.js");
describe("run", () => {
// Mock the external libraries and services used by the action
let infoMock: jest.SpiedFunction<typeof LoggerService.prototype.info>;
let debugMock: jest.SpiedFunction<typeof LoggerService.prototype.debug>;
let setFailedMock: jest.SpiedFunction<typeof core.setFailed>;
let getInputsMock: jest.SpiedFunction<typeof InputService.prototype.getInputs>;
let installMock: jest.SpiedFunction<typeof DockerComposeInstallerService.prototype.install>;
let upMock: jest.SpiedFunction<typeof DockerComposeService.prototype.up>;
@ -17,9 +48,8 @@ describe("run", () => {
beforeEach(() => {
jest.clearAllMocks();
infoMock = jest.spyOn(LoggerService.prototype, "info").mockImplementation();
debugMock = jest.spyOn(LoggerService.prototype, "debug").mockImplementation();
setFailedMock = jest.spyOn(core, "setFailed").mockImplementation();
infoMock = jest.spyOn(LoggerService.prototype, "info").mockImplementation(() => {});
debugMock = jest.spyOn(LoggerService.prototype, "debug").mockImplementation(() => {});
getInputsMock = jest.spyOn(InputService.prototype, "getInputs");
installMock = jest.spyOn(DockerComposeInstallerService.prototype, "install");
upMock = jest.spyOn(DockerComposeService.prototype, "up");
@ -45,7 +75,7 @@ describe("run", () => {
upMock.mockResolvedValue();
// Act
await indexRunner.run();
await run();
// Assert
expect(infoMock).toHaveBeenCalledWith("Setting up docker compose version 1.29.2");
@ -89,7 +119,7 @@ describe("run", () => {
}));
// Act
await indexRunner.run();
await run();
// Assert
expect(upMock).toHaveBeenCalledWith({
@ -123,7 +153,7 @@ describe("run", () => {
}));
// Act
await indexRunner.run();
await run();
// Assert
expect(setFailedMock).toHaveBeenCalledWith("Error: Test error");
@ -148,7 +178,7 @@ describe("run", () => {
}));
// Act
await indexRunner.run();
await run();
// Assert
expect(setFailedMock).toHaveBeenCalledWith('"Test error"');

View File

@ -1,9 +1,9 @@
import { setFailed } from "@actions/core";
import { InputService } from "./services/input.service";
import { LoggerService } from "./services/logger.service";
import { DockerComposeService } from "./services/docker-compose.service";
import { DockerComposeInstallerService } from "./services/docker-compose-installer.service";
import { ManualInstallerAdapter } from "./services/installer-adapter/manual-installer-adapter";
import { InputService } from "./services/input.service.js";
import { LoggerService } from "./services/logger.service.js";
import { DockerComposeService } from "./services/docker-compose.service.js";
import { DockerComposeInstallerService } from "./services/docker-compose-installer.service.js";
import { ManualInstallerAdapter } from "./services/installer-adapter/manual-installer-adapter.js";
/**
* The run function for the action.

View File

@ -1,10 +1,42 @@
import * as core from "@actions/core";
import { DockerComposeService } from "./services/docker-compose.service";
import { InputService } from "./services/input.service";
import { LoggerService, LogLevel } from "./services/logger.service";
import { DockerComposeInstallerService } from "./services/docker-compose-installer.service";
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
// Mock @actions/core
const setFailedMock = jest.fn();
jest.unstable_mockModule("@actions/core", () => ({
setFailed: setFailedMock,
getInput: jest.fn().mockReturnValue(""),
getMultilineInput: jest.fn().mockReturnValue([]),
debug: jest.fn(),
info: jest.fn(),
warning: jest.fn(),
}));
// Mock docker-compose
jest.unstable_mockModule("docker-compose", () => ({
upAll: jest.fn(),
upMany: jest.fn(),
down: jest.fn(),
logs: jest.fn(),
version: jest
.fn<() => Promise<{ data: { version: string } }>>()
.mockResolvedValue({ data: { version: "1.2.3" } }),
}));
// Mock node:fs
jest.unstable_mockModule("node:fs", () => ({
existsSync: jest.fn().mockReturnValue(true),
default: { existsSync: jest.fn().mockReturnValue(true) },
}));
// Dynamic imports after mock setup
const { InputService } = await import("./services/input.service.js");
const { LoggerService, LogLevel } = await import("./services/logger.service.js");
const { DockerComposeInstallerService } = await import(
"./services/docker-compose-installer.service.js"
);
const { DockerComposeService } = await import("./services/docker-compose.service.js");
let setFailedMock: jest.SpiedFunction<typeof core.setFailed>;
let getInputsMock: jest.SpiedFunction<typeof InputService.prototype.getInputs>;
let debugMock: jest.SpiedFunction<typeof LoggerService.prototype.debug>;
let infoMock: jest.SpiedFunction<typeof LoggerService.prototype.info>;
@ -15,9 +47,8 @@ describe("index", () => {
beforeEach(() => {
jest.clearAllMocks();
setFailedMock = jest.spyOn(core, "setFailed").mockImplementation();
infoMock = jest.spyOn(LoggerService.prototype, "info").mockImplementation();
debugMock = jest.spyOn(LoggerService.prototype, "debug").mockImplementation();
infoMock = jest.spyOn(LoggerService.prototype, "info").mockImplementation(() => {});
debugMock = jest.spyOn(LoggerService.prototype, "debug").mockImplementation(() => {});
getInputsMock = jest.spyOn(InputService.prototype, "getInputs");
installMock = jest.spyOn(DockerComposeInstallerService.prototype, "install");
upMock = jest.spyOn(DockerComposeService.prototype, "up");
@ -40,8 +71,7 @@ describe("index", () => {
installMock.mockResolvedValue("1.2.3");
upMock.mockResolvedValueOnce();
// eslint-disable-next-line @typescript-eslint/no-require-imports
await require("../src/index");
await import("./index.js");
await new Promise((resolve) => setTimeout(resolve, 0));
expect(infoMock).toHaveBeenNthCalledWith(1, "Setting up docker compose");

View File

@ -1,6 +1,6 @@
/**
* The entrypoint for the action.
*/
import { run } from "./index-runner";
import { run } from "./index-runner.js";
run();

View File

@ -1,27 +1,55 @@
import * as core from "@actions/core";
import { InputService } from "./services/input.service";
import { LoggerService, LogLevel } from "./services/logger.service";
import * as postRunner from "./post-runner";
import { DockerComposeService } from "./services/docker-compose.service";
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
// Mock the external libraries and services used by the action
let infoMock: jest.SpiedFunction<typeof LoggerService.prototype.info>;
let debugMock: jest.SpiedFunction<typeof LoggerService.prototype.debug>;
let setFailedMock: jest.SpiedFunction<typeof core.setFailed>;
let getInputsMock: jest.SpiedFunction<typeof InputService.prototype.getInputs>;
let downMock: jest.SpiedFunction<typeof DockerComposeService.prototype.down>;
let logsMock: jest.SpiedFunction<typeof DockerComposeService.prototype.logs>;
// Mock @actions/core
const setFailedMock = jest.fn();
jest.unstable_mockModule("@actions/core", () => ({
setFailed: setFailedMock,
getInput: jest.fn().mockReturnValue(""),
getMultilineInput: jest.fn().mockReturnValue([]),
debug: jest.fn(),
info: jest.fn(),
warning: jest.fn(),
}));
// Mock docker-compose
const logsMock = jest.fn();
const downMock = jest.fn();
jest.unstable_mockModule("docker-compose", () => ({
logs: logsMock,
down: downMock,
upAll: jest.fn(),
upMany: jest.fn(),
}));
// Mock node:fs
jest.unstable_mockModule("node:fs", () => ({
existsSync: jest.fn().mockReturnValue(true),
default: { existsSync: jest.fn().mockReturnValue(true) },
}));
// Dynamic imports after mock setup
const { run } = await import("./post-runner.js");
const { InputService } = await import("./services/input.service.js");
const { LoggerService, LogLevel } = await import("./services/logger.service.js");
const { DockerComposeService } = await import("./services/docker-compose.service.js");
describe("run", () => {
let infoMock: jest.SpiedFunction<typeof LoggerService.prototype.info>;
let debugMock: jest.SpiedFunction<typeof LoggerService.prototype.debug>;
let getInputsMock: jest.SpiedFunction<typeof InputService.prototype.getInputs>;
let serviceDownMock: jest.SpiedFunction<typeof DockerComposeService.prototype.down>;
let serviceLogsMock: jest.SpiedFunction<typeof DockerComposeService.prototype.logs>;
beforeEach(() => {
jest.clearAllMocks();
infoMock = jest.spyOn(LoggerService.prototype, "info").mockImplementation();
debugMock = jest.spyOn(LoggerService.prototype, "debug").mockImplementation();
setFailedMock = jest.spyOn(core, "setFailed").mockImplementation();
infoMock = jest.spyOn(LoggerService.prototype, "info").mockImplementation(() => {});
debugMock = jest.spyOn(LoggerService.prototype, "debug").mockImplementation(() => {});
getInputsMock = jest.spyOn(InputService.prototype, "getInputs");
downMock = jest.spyOn(DockerComposeService.prototype, "down");
logsMock = jest.spyOn(DockerComposeService.prototype, "logs");
serviceDownMock = jest.spyOn(DockerComposeService.prototype, "down");
serviceLogsMock = jest.spyOn(DockerComposeService.prototype, "logs");
});
it("should bring down docker compose service(s) and log output", async () => {
@ -39,15 +67,14 @@ describe("run", () => {
serviceLogLevel: LogLevel.Debug,
}));
logsMock.mockResolvedValue({ error: "", output: "test logs" });
downMock.mockResolvedValue();
serviceLogsMock.mockResolvedValue({ error: "", output: "test logs" });
serviceDownMock.mockResolvedValue();
// Act
await postRunner.run();
await run();
// Assert
expect(logsMock).toHaveBeenCalledWith({
expect(serviceLogsMock).toHaveBeenCalledWith({
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
composeFlags: [],
@ -56,7 +83,7 @@ describe("run", () => {
serviceLogger: debugMock,
});
expect(downMock).toHaveBeenCalledWith({
expect(serviceDownMock).toHaveBeenCalledWith({
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
composeFlags: [],
@ -66,9 +93,7 @@ describe("run", () => {
});
expect(debugMock).toHaveBeenCalledWith("docker compose logs:\ntest logs");
expect(infoMock).toHaveBeenCalledWith("docker compose is down");
expect(setFailedMock).not.toHaveBeenCalled();
});
@ -87,38 +112,19 @@ describe("run", () => {
serviceLogLevel: LogLevel.Debug,
}));
logsMock.mockResolvedValue({
serviceLogsMock.mockResolvedValue({
error: "test logs error",
output: "test logs output",
});
downMock.mockResolvedValue();
serviceDownMock.mockResolvedValue();
// Act
await postRunner.run();
await run();
// Assert
expect(logsMock).toHaveBeenCalledWith({
composeFiles: ["docker-compose.yml"],
composeFlags: [],
cwd: "/current/working/dir",
dockerFlags: [],
services: [],
serviceLogger: debugMock,
});
expect(downMock).toHaveBeenCalledWith({
composeFiles: ["docker-compose.yml"],
composeFlags: [],
cwd: "/current/working/dir",
dockerFlags: [],
downFlags: [],
serviceLogger: debugMock,
});
expect(debugMock).toHaveBeenCalledWith("docker compose error:\ntest logs error");
expect(debugMock).toHaveBeenCalledWith("docker compose logs:\ntest logs output");
expect(infoMock).toHaveBeenCalledWith("docker compose is down");
});
@ -129,7 +135,7 @@ describe("run", () => {
});
// Act
await postRunner.run();
await run();
// Assert
expect(setFailedMock).toHaveBeenCalledWith("Error: An error occurred");
@ -138,7 +144,7 @@ describe("run", () => {
it("should handle errors and call setFailed", async () => {
// Arrange
const error = new Error("Test error");
downMock.mockRejectedValue(error);
serviceDownMock.mockRejectedValue(error);
getInputsMock.mockImplementation(() => ({
dockerFlags: [],
@ -154,7 +160,7 @@ describe("run", () => {
}));
// Act
await postRunner.run();
await run();
// Assert
expect(setFailedMock).toHaveBeenCalledWith("Error: Test error");
@ -163,7 +169,7 @@ describe("run", () => {
it("should handle unknown errors and call setFailed", async () => {
// Arrange
const error = "Test error";
downMock.mockRejectedValue(error);
serviceDownMock.mockRejectedValue(error);
getInputsMock.mockImplementation(() => ({
dockerFlags: [],
@ -179,7 +185,7 @@ describe("run", () => {
}));
// Act
await postRunner.run();
await run();
// Assert
expect(setFailedMock).toHaveBeenCalledWith('"Test error"');

View File

@ -1,7 +1,7 @@
import { setFailed } from "@actions/core";
import { InputService } from "./services/input.service";
import { LoggerService } from "./services/logger.service";
import { DockerComposeService } from "./services/docker-compose.service";
import { InputService } from "./services/input.service.js";
import { LoggerService } from "./services/logger.service.js";
import { DockerComposeService } from "./services/docker-compose.service.js";
/**
* The run function for the action.

View File

@ -1,25 +1,54 @@
import * as core from "@actions/core";
import { DockerComposeService } from "./services/docker-compose.service";
import { InputService } from "./services/input.service";
import { LoggerService, LogLevel } from "./services/logger.service";
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
// Mock @actions/core
const setFailedMock = jest.fn();
jest.unstable_mockModule("@actions/core", () => ({
setFailed: setFailedMock,
getInput: jest.fn().mockReturnValue(""),
getMultilineInput: jest.fn().mockReturnValue([]),
debug: jest.fn(),
info: jest.fn(),
warning: jest.fn(),
}));
// Mock docker-compose
const logsMock = jest.fn();
const downMock = jest.fn();
jest.unstable_mockModule("docker-compose", () => ({
logs: logsMock,
down: downMock,
upAll: jest.fn(),
upMany: jest.fn(),
}));
// Mock node:fs
jest.unstable_mockModule("node:fs", () => ({
existsSync: jest.fn().mockReturnValue(true),
default: { existsSync: jest.fn().mockReturnValue(true) },
}));
// Dynamic imports after mock setup
const { InputService } = await import("./services/input.service.js");
const { LoggerService, LogLevel } = await import("./services/logger.service.js");
const { DockerComposeService } = await import("./services/docker-compose.service.js");
let setFailedMock: jest.SpiedFunction<typeof core.setFailed>;
let getInputsMock: jest.SpiedFunction<typeof InputService.prototype.getInputs>;
let debugMock: jest.SpiedFunction<typeof LoggerService.prototype.debug>;
let infoMock: jest.SpiedFunction<typeof LoggerService.prototype.info>;
let logsMock: jest.SpiedFunction<typeof DockerComposeService.prototype.logs>;
let downMock: jest.SpiedFunction<typeof DockerComposeService.prototype.down>;
let serviceLogsMock: jest.SpiedFunction<typeof DockerComposeService.prototype.logs>;
let serviceDownMock: jest.SpiedFunction<typeof DockerComposeService.prototype.down>;
describe("post", () => {
beforeEach(() => {
jest.clearAllMocks();
setFailedMock = jest.spyOn(core, "setFailed").mockImplementation();
infoMock = jest.spyOn(LoggerService.prototype, "info").mockImplementation();
debugMock = jest.spyOn(LoggerService.prototype, "debug").mockImplementation();
infoMock = jest.spyOn(LoggerService.prototype, "info").mockImplementation(() => {});
debugMock = jest.spyOn(LoggerService.prototype, "debug").mockImplementation(() => {});
getInputsMock = jest.spyOn(InputService.prototype, "getInputs");
logsMock = jest.spyOn(DockerComposeService.prototype, "logs");
downMock = jest.spyOn(DockerComposeService.prototype, "down");
serviceLogsMock = jest.spyOn(DockerComposeService.prototype, "logs");
serviceDownMock = jest.spyOn(DockerComposeService.prototype, "down");
});
it("calls run when imported", async () => {
@ -36,14 +65,13 @@ describe("post", () => {
serviceLogLevel: LogLevel.Debug,
}));
logsMock.mockResolvedValue({ error: "", output: "test logs" });
downMock.mockResolvedValueOnce();
serviceLogsMock.mockResolvedValue({ error: "", output: "test logs" });
serviceDownMock.mockResolvedValueOnce();
// eslint-disable-next-line @typescript-eslint/no-require-imports
await require("../src/post");
await import("./post.js");
await new Promise((resolve) => setTimeout(resolve, 0));
expect(logsMock).toHaveBeenCalledWith({
expect(serviceLogsMock).toHaveBeenCalledWith({
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
composeFlags: [],
@ -52,7 +80,7 @@ describe("post", () => {
serviceLogger: debugMock,
});
expect(downMock).toHaveBeenCalledWith({
expect(serviceDownMock).toHaveBeenCalledWith({
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
composeFlags: [],

View File

@ -1,6 +1,6 @@
/**
* The entrypoint for the post action.
*/
import { run } from "./post-runner";
import { run } from "./post-runner.js";
run();

View File

@ -1,27 +1,32 @@
import * as dockerCompose from "docker-compose";
import { DockerComposeInstallerService } from "./docker-compose-installer.service";
import { ManualInstallerAdapter } from "./installer-adapter/manual-installer-adapter";
import { jest, describe, it, expect, beforeEach, afterEach } from "@jest/globals";
import type { IDockerComposeResult } from "docker-compose";
import { MockAgent, setGlobalDispatcher } from "undici";
jest.mock("docker-compose");
// Mock docker-compose before importing the module under test
const versionMock = jest.fn<() => Promise<IDockerComposeResult & { data: { version: string } }>>();
jest.unstable_mockModule("docker-compose", () => ({
version: versionMock,
}));
// Create manual installer adapter mock
const manualInstallerAdapterMock = {
install: jest.fn<(version: string) => Promise<void>>(),
};
// Dynamic import after mock setup
const { DockerComposeInstallerService } = await import("./docker-compose-installer.service.js");
describe("DockerComposeInstallerService", () => {
let mockAgent: MockAgent;
let versionMock: jest.SpiedFunction<typeof dockerCompose.version>;
let manualInstallerAdapterMock: jest.Mocked<ManualInstallerAdapter>;
let service: DockerComposeInstallerService;
let service: InstanceType<typeof DockerComposeInstallerService>;
beforeEach(() => {
jest.clearAllMocks();
mockAgent = new MockAgent();
mockAgent.disableNetConnect();
versionMock = jest.spyOn(dockerCompose, "version").mockImplementation();
manualInstallerAdapterMock = {
install: jest.fn(),
} as unknown as jest.Mocked<ManualInstallerAdapter>;
service = new DockerComposeInstallerService(manualInstallerAdapterMock);
service = new DockerComposeInstallerService(manualInstallerAdapterMock as never);
});
afterEach(() => {
@ -29,6 +34,29 @@ describe("DockerComposeInstallerService", () => {
});
describe("install", () => {
it("should return current version when no version is provided", async () => {
// Arrange
versionMock.mockResolvedValue({
exitCode: 0,
out: "",
err: "",
data: {
version: "2.0.0",
},
});
// Act
const result = await service.install({
composeVersion: null,
cwd: "/path/to/cwd",
githubToken: null,
});
// Assert
expect(result).toBe("2.0.0");
expect(manualInstallerAdapterMock.install).not.toHaveBeenCalled();
});
it("should not install anything when expected version is already installed", async () => {
// Arrange
versionMock.mockResolvedValue({

View File

@ -1,7 +1,7 @@
import * as github from "@actions/github";
import { version } from "docker-compose";
import { COMPOSE_VERSION_LATEST, Inputs } from "./input.service";
import { ManualInstallerAdapter } from "./installer-adapter/manual-installer-adapter";
import { COMPOSE_VERSION_LATEST, Inputs } from "./input.service.js";
import { ManualInstallerAdapter } from "./installer-adapter/manual-installer-adapter.js";
export type InstallInputs = {
composeVersion: Inputs["composeVersion"];

View File

@ -1,39 +1,46 @@
import * as dockerCompose from "docker-compose";
import { DockerComposeService, DownInputs, LogsInputs, UpInputs } from "./docker-compose.service";
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
import type { IDockerComposeOptions, IDockerComposeResult } from "docker-compose";
jest.mock("docker-compose");
// Mock docker-compose before importing the module under test
const upAllMock = jest.fn<(options: IDockerComposeOptions) => Promise<IDockerComposeResult>>();
const upManyMock =
jest.fn<(services: string[], options: IDockerComposeOptions) => Promise<IDockerComposeResult>>();
const downMock = jest.fn<(options: IDockerComposeOptions) => Promise<IDockerComposeResult>>();
const logsMock =
jest.fn<(services: string[], options: IDockerComposeOptions) => Promise<IDockerComposeResult>>();
jest.unstable_mockModule("docker-compose", () => ({
upAll: upAllMock,
upMany: upManyMock,
down: downMock,
logs: logsMock,
}));
// Dynamic import after mock setup
const { DockerComposeService } = await import("./docker-compose.service.js");
describe("DockerComposeService", () => {
let service: DockerComposeService;
let upAllMock: jest.SpiedFunction<typeof dockerCompose.upAll>;
let upManyMock: jest.SpiedFunction<typeof dockerCompose.upMany>;
let downMock: jest.SpiedFunction<typeof dockerCompose.down>;
let logsMock: jest.SpiedFunction<typeof dockerCompose.logs>;
let service: InstanceType<typeof DockerComposeService>;
beforeEach(() => {
service = new DockerComposeService();
upAllMock = jest.spyOn(dockerCompose, "upAll").mockImplementation();
upManyMock = jest.spyOn(dockerCompose, "upMany").mockImplementation();
downMock = jest.spyOn(dockerCompose, "down").mockImplementation();
logsMock = jest.spyOn(dockerCompose, "logs").mockImplementation();
});
afterEach(() => {
jest.clearAllMocks();
service = new DockerComposeService();
});
describe("up", () => {
it("should call up with correct options", async () => {
const upInputs: UpInputs = {
dockerFlags: [],
const upInputs = {
dockerFlags: [] as string[],
composeFiles: ["docker-compose.yml"],
services: [],
composeFlags: [],
upFlags: [],
services: [] as string[],
composeFlags: [] as string[],
upFlags: [] as string[],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
upAllMock.mockResolvedValue({ exitCode: 0, err: "", out: "" });
await service.up(upInputs);
expect(upAllMock).toHaveBeenCalledWith({
@ -49,7 +56,7 @@ describe("DockerComposeService", () => {
});
// Ensure callback is calling the service logger
const callback = upAllMock?.mock?.calls[0][0]?.callback;
const callback = (upAllMock.mock.calls[0][0] as IDockerComposeOptions)?.callback;
expect(callback).toBeDefined();
const message = "test log output";
@ -62,16 +69,18 @@ describe("DockerComposeService", () => {
});
it("should call up with specific docker flags", async () => {
const upInputs: UpInputs = {
const upInputs = {
dockerFlags: ["--context", "dev"],
composeFiles: ["docker-compose.yml"],
services: [],
composeFlags: [],
upFlags: [],
services: [] as string[],
composeFlags: [] as string[],
upFlags: [] as string[],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
upAllMock.mockResolvedValue({ exitCode: 0, err: "", out: "" });
await service.up(upInputs);
expect(upAllMock).toHaveBeenCalledWith({
@ -88,16 +97,18 @@ describe("DockerComposeService", () => {
});
it("should call up with specific services", async () => {
const upInputs: UpInputs = {
dockerFlags: [],
const upInputs = {
dockerFlags: [] as string[],
composeFiles: ["docker-compose.yml"],
services: ["helloworld2", "helloworld3"],
composeFlags: [],
composeFlags: [] as string[],
upFlags: ["--build"],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
upManyMock.mockResolvedValue({ exitCode: 0, err: "", out: "" });
await service.up(upInputs);
expect(upManyMock).toHaveBeenCalledWith(["helloworld2", "helloworld3"], {
@ -114,12 +125,12 @@ describe("DockerComposeService", () => {
});
it("should throw formatted error when upAll fails with docker-compose result", async () => {
const upInputs: UpInputs = {
dockerFlags: [],
const upInputs = {
dockerFlags: [] as string[],
composeFiles: ["docker-compose.yml"],
services: [],
composeFlags: [],
upFlags: [],
services: [] as string[],
composeFlags: [] as string[],
upFlags: [] as string[],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
@ -139,12 +150,12 @@ describe("DockerComposeService", () => {
});
it("should throw formatted error when upMany fails with docker-compose result", async () => {
const upInputs: UpInputs = {
dockerFlags: [],
const upInputs = {
dockerFlags: [] as string[],
composeFiles: ["docker-compose.yml"],
services: ["web"],
composeFlags: [],
upFlags: [],
composeFlags: [] as string[],
upFlags: [] as string[],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
@ -165,12 +176,12 @@ describe("DockerComposeService", () => {
});
it("should pass through docker-compose result without exit code", async () => {
const upInputs: UpInputs = {
dockerFlags: [],
const upInputs = {
dockerFlags: [] as string[],
composeFiles: ["docker-compose.yml"],
services: [],
composeFlags: [],
upFlags: [],
services: [] as string[],
composeFlags: [] as string[],
upFlags: [] as string[],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
@ -187,12 +198,12 @@ describe("DockerComposeService", () => {
});
it("should pass through standard Error objects", async () => {
const upInputs: UpInputs = {
dockerFlags: [],
const upInputs = {
dockerFlags: [] as string[],
composeFiles: ["docker-compose.yml"],
services: [],
composeFlags: [],
upFlags: [],
services: [] as string[],
composeFlags: [] as string[],
upFlags: [] as string[],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
@ -204,12 +215,12 @@ describe("DockerComposeService", () => {
});
it("should pass through error strings", async () => {
const upInputs: UpInputs = {
dockerFlags: [],
const upInputs = {
dockerFlags: [] as string[],
composeFiles: ["docker-compose.yml"],
services: [],
composeFlags: [],
upFlags: [],
services: [] as string[],
composeFlags: [] as string[],
upFlags: [] as string[],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
@ -221,12 +232,12 @@ describe("DockerComposeService", () => {
});
it("should handle unknown error types gracefully", async () => {
const upInputs: UpInputs = {
dockerFlags: [],
const upInputs = {
dockerFlags: [] as string[],
composeFiles: ["docker-compose.yml"],
services: [],
composeFlags: [],
upFlags: [],
services: [] as string[],
composeFlags: [] as string[],
upFlags: [] as string[],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
@ -240,15 +251,17 @@ describe("DockerComposeService", () => {
describe("down", () => {
it("should call down with correct options", async () => {
const downInputs: DownInputs = {
dockerFlags: [],
composeFiles: [],
composeFlags: [],
const downInputs = {
dockerFlags: [] as string[],
composeFiles: [] as string[],
composeFlags: [] as string[],
downFlags: ["--volumes", "--remove-orphans"],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
downMock.mockResolvedValue({ exitCode: 0, err: "", out: "" });
await service.down(downInputs);
expect(downMock).toHaveBeenCalledWith({
@ -265,11 +278,11 @@ describe("DockerComposeService", () => {
});
it("should throw formatted error when down fails with docker-compose result", async () => {
const downInputs: DownInputs = {
dockerFlags: [],
composeFiles: [],
composeFlags: [],
downFlags: [],
const downInputs = {
dockerFlags: [] as string[],
composeFiles: [] as string[],
composeFlags: [] as string[],
downFlags: [] as string[],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
@ -292,11 +305,11 @@ describe("DockerComposeService", () => {
describe("logs", () => {
it("should call logs with correct options", async () => {
const debugMock = jest.fn();
const logsInputs: LogsInputs = {
dockerFlags: [],
const logsInputs = {
dockerFlags: [] as string[],
composeFiles: ["docker-compose.yml"],
services: ["helloworld2", "helloworld3"],
composeFlags: [],
composeFlags: [] as string[],
cwd: "/current/working/dir",
serviceLogger: debugMock,
};
@ -305,7 +318,7 @@ describe("DockerComposeService", () => {
await service.logs(logsInputs);
expect(dockerCompose.logs).toHaveBeenCalledWith(["helloworld2", "helloworld3"], {
expect(logsMock).toHaveBeenCalledWith(["helloworld2", "helloworld3"], {
composeOptions: [],
config: ["docker-compose.yml"],
cwd: "/current/working/dir",

View File

@ -7,7 +7,7 @@ import {
upAll,
upMany,
} from "docker-compose";
import { Inputs } from "./input.service";
import { Inputs } from "./input.service.js";
type OptionsInputs = {
dockerFlags: Inputs["dockerFlags"];

View File

@ -1,21 +1,36 @@
import * as core from "@actions/core";
import fs from "fs";
import { InputService, InputNames } from "./input.service";
import { LogLevel } from "./logger.service";
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
// Mock @actions/core before importing the module under test
const getInputMock = jest.fn<(name: string, options?: { required?: boolean }) => string>();
const getMultilineInputMock =
jest.fn<(name: string, options?: { required?: boolean }) => string[]>();
jest.unstable_mockModule("@actions/core", () => ({
getInput: getInputMock,
getMultilineInput: getMultilineInputMock,
debug: jest.fn(),
info: jest.fn(),
warning: jest.fn(),
}));
// Mock node:fs
const existsSyncMock = jest.fn<(path: string) => boolean>();
jest.unstable_mockModule("node:fs", () => ({
existsSync: existsSyncMock,
default: { existsSync: existsSyncMock },
}));
// Dynamic imports after mock setup
const { InputService, InputNames } = await import("./input.service.js");
const { LogLevel } = await import("./logger.service.js");
describe("InputService", () => {
let service: InputService;
let getInputMock: jest.SpiedFunction<typeof core.getInput>;
let getMultilineInputMock: jest.SpiedFunction<typeof core.getMultilineInput>;
let existsSyncMock: jest.SpiedFunction<typeof fs.existsSync>;
let service: InstanceType<typeof InputService>;
beforeEach(() => {
jest.clearAllMocks();
existsSyncMock = jest.spyOn(fs, "existsSync").mockImplementation();
getInputMock = jest.spyOn(core, "getInput").mockImplementation();
getMultilineInputMock = jest.spyOn(core, "getMultilineInput").mockImplementation();
getMultilineInputMock.mockImplementation((inputName) => {
switch (inputName) {
case InputNames.ComposeFile:
@ -25,11 +40,9 @@ describe("InputService", () => {
}
});
service = new InputService();
});
getInputMock.mockReturnValue("");
afterEach(() => {
jest.clearAllMocks();
service = new InputService();
});
describe("getInputs", () => {
@ -82,6 +95,50 @@ describe("InputService", () => {
expect(inputs.composeFiles).toEqual(["file1", "file2"]);
});
it("should ignore empty compose file entries", () => {
getMultilineInputMock.mockImplementation((inputName) => {
switch (inputName) {
case InputNames.ComposeFile:
return [" ", "file1"];
default:
return [];
}
});
getInputMock.mockReturnValue("");
existsSyncMock.mockReturnValue(true);
const inputs = service.getInputs();
expect(inputs.composeFiles).toEqual(["file1"]);
});
it("should accept compose file when it exists at the original path", () => {
getMultilineInputMock.mockImplementation((inputName) => {
switch (inputName) {
case InputNames.ComposeFile:
return ["./compose.yml"];
default:
return [];
}
});
getInputMock.mockImplementation((inputName) => {
switch (inputName) {
case InputNames.Cwd:
return "/current/working/directory";
default:
return "";
}
});
existsSyncMock.mockImplementation((file) => file === "./compose.yml");
const inputs = service.getInputs();
expect(inputs.composeFiles).toEqual(["./compose.yml"]);
});
it("should throws an error when a compose file does not exist", () => {
getMultilineInputMock.mockImplementation((inputName) => {
switch (inputName) {

View File

@ -1,7 +1,7 @@
import { getInput, getMultilineInput } from "@actions/core";
import { existsSync } from "fs";
import { join } from "path";
import { LogLevel } from "./logger.service";
import { existsSync } from "node:fs";
import { join } from "node:path";
import { LogLevel } from "./logger.service.js";
export type Inputs = {
dockerFlags: string[];

View File

@ -1,31 +1,40 @@
import { ManualInstallerAdapter } from "./manual-installer-adapter";
import * as exec from "@actions/exec";
import * as io from "@actions/io";
import * as toolCache from "@actions/tool-cache";
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
import type { ExecOptions } from "@actions/exec";
jest.mock("@actions/exec");
jest.mock("@actions/io");
jest.mock("@actions/tool-cache");
// Mock @actions/exec
const execMock =
jest.fn<(command: string, args?: string[], options?: ExecOptions) => Promise<number>>();
jest.unstable_mockModule("@actions/exec", () => ({
exec: execMock,
}));
// Mock @actions/io
const mkdirPMock = jest.fn<(fsPath: string) => Promise<void>>();
jest.unstable_mockModule("@actions/io", () => ({
mkdirP: mkdirPMock,
}));
// Mock @actions/tool-cache
const cacheFileMock = jest.fn<() => Promise<string>>();
const downloadToolMock = jest.fn<() => Promise<string>>();
jest.unstable_mockModule("@actions/tool-cache", () => ({
cacheFile: cacheFileMock,
downloadTool: downloadToolMock,
}));
// Dynamic import after mock setup
const { ManualInstallerAdapter } = await import("./manual-installer-adapter.js");
describe("ManualInstallerAdapter", () => {
let mkdirPMock: jest.SpiedFunction<typeof io.mkdirP>;
let execMock: jest.SpiedFunction<typeof exec.exec>;
let cacheFileMock: jest.SpiedFunction<typeof toolCache.cacheFile>;
let downloadToolMock: jest.SpiedFunction<typeof toolCache.downloadTool>;
let adapter: ManualInstallerAdapter;
let adapter: InstanceType<typeof ManualInstallerAdapter>;
beforeEach(() => {
mkdirPMock = jest.spyOn(io, "mkdirP").mockImplementation();
execMock = jest.spyOn(exec, "exec").mockImplementation();
cacheFileMock = jest.spyOn(toolCache, "cacheFile").mockImplementation();
downloadToolMock = jest.spyOn(toolCache, "downloadTool").mockImplementation();
adapter = new ManualInstallerAdapter();
});
afterEach(() => {
jest.clearAllMocks();
delete process.env.DOCKER_CONFIG;
adapter = new ManualInstallerAdapter();
});
describe("install", () => {
@ -68,6 +77,32 @@ describe("ManualInstallerAdapter", () => {
);
});
it("should use DOCKER_CONFIG when set", async () => {
// Arrange
const version = "v2.29.0";
execMock.mockImplementationOnce(async (_command, _args, options) => {
options?.listeners?.stdout?.(Buffer.from("Linux\n"));
return 0;
});
execMock.mockImplementationOnce(async (_command, _args, options) => {
options?.listeners?.stdout?.(Buffer.from("x86_64\n"));
return 0;
});
process.env.DOCKER_CONFIG = "/custom/docker";
// Act
await adapter.install(version);
// Assert
expect(downloadToolMock).toHaveBeenCalledWith(
"https://github.com/docker/compose/releases/download/v2.29.0/docker-compose-Linux-x86_64",
"/custom/docker/cli-plugins/docker-compose"
);
});
it("should handle version without 'v' prefix", async () => {
// Arrange
const version = "2.29.0";
@ -100,6 +135,35 @@ describe("ManualInstallerAdapter", () => {
);
});
it("should not add 'v' prefix for 1.x versions", async () => {
// Arrange
const version = "1.29.0";
execMock.mockImplementationOnce(async (_command, _args, options) => {
options?.listeners?.stdout?.(Buffer.from("Linux\n"));
return 0;
});
execMock.mockImplementationOnce(async (_command, _args, options) => {
options?.listeners?.stdout?.(Buffer.from("x86_64\n"));
return 0;
});
delete process.env.DOCKER_CONFIG;
Object.defineProperty(process.env, "HOME", {
value: "/home/test",
});
// Act
await adapter.install(version);
// Assert
expect(downloadToolMock).toHaveBeenCalledWith(
"https://github.com/docker/compose/releases/download/1.29.0/docker-compose-Linux-x86_64",
"/home/test/.docker/cli-plugins/docker-compose"
);
});
it("should throw an error if a command fails", async () => {
// Arrange
const version = "v2.29.0";

View File

@ -1,8 +1,8 @@
import { exec } from "@actions/exec";
import { mkdirP } from "@actions/io";
import { basename } from "path";
import { basename } from "node:path";
import { cacheFile, downloadTool } from "@actions/tool-cache";
import { DockerComposeInstallerAdapter } from "./docker-compose-installer-adapter";
import { DockerComposeInstallerAdapter } from "./docker-compose-installer-adapter.js";
export class ManualInstallerAdapter implements DockerComposeInstallerAdapter {
async install(version: string): Promise<void> {

View File

@ -1,46 +1,51 @@
import { LoggerService, LogLevel } from "./logger.service";
import { debug, info, warning } from "@actions/core";
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
jest.mock("@actions/core", () => ({
warning: jest.fn(),
info: jest.fn(),
debug: jest.fn(),
// Import types directly from the module
import type { LogLevel as LogLevelType } from "./logger.service.js";
// Mock @actions/core before importing the module under test
const warningMock = jest.fn();
const infoMock = jest.fn();
const debugMock = jest.fn();
jest.unstable_mockModule("@actions/core", () => ({
warning: warningMock,
info: infoMock,
debug: debugMock,
}));
// Dynamic import after mock setup
const { LoggerService, LogLevel } = await import("./logger.service.js");
describe("LoggerService", () => {
let loggerService: LoggerService;
let loggerService: InstanceType<typeof LoggerService>;
beforeEach(() => {
loggerService = new LoggerService();
});
afterEach(() => {
jest.clearAllMocks();
loggerService = new LoggerService();
});
describe("warn", () => {
it("should call warning with the correct message", () => {
const message = "This is a warning message";
loggerService.warn(message);
expect(warning).toHaveBeenCalledWith(message);
expect(warningMock).toHaveBeenCalledWith(message);
});
});
describe("info", () => {
it("should call info with the correct message", () => {
const message = "This is an info message";
loggerService.info(message);
expect(info).toHaveBeenCalledWith(message);
expect(infoMock).toHaveBeenCalledWith(message);
});
});
describe("debug", () => {
it("should call debug with the correct message", () => {
const message = "This is a debug message";
loggerService.debug(message);
expect(debug).toHaveBeenCalledWith(message);
expect(debugMock).toHaveBeenCalledWith(message);
});
});
@ -56,7 +61,7 @@ describe("LoggerService", () => {
});
it("should default to info level if an unknown level is provided", () => {
const logger = loggerService.getServiceLogger("unknown" as LogLevel);
const logger = loggerService.getServiceLogger("unknown" as LogLevelType);
expect(logger).toBe(loggerService.info);
});
});