diff --git a/.github/ghadocs/examples/1_environment-variables.md b/.github/ghadocs/examples/1_environment-variables.md deleted file mode 100644 index 77e4eed..0000000 --- a/.github/ghadocs/examples/1_environment-variables.md +++ /dev/null @@ -1,13 +0,0 @@ - - -### Example Using environment variables - -```yaml -steps: - - uses: actions/checkout@v4.2.2 - - uses: hoverkraft-tech/compose-action@v1.5.1 - with: - compose-file: "./docker/docker-compose.yml" - env: - CUSTOM_VARIABLE: "test" -``` diff --git a/.github/ghadocs/examples/2_services.md b/.github/ghadocs/examples/2_services.md deleted file mode 100644 index 78a4af2..0000000 --- a/.github/ghadocs/examples/2_services.md +++ /dev/null @@ -1,17 +0,0 @@ - - -### Example using `services` - -Perform `docker compose up` to some given service instead of all of them - -```yaml -steps: - # need checkout before using compose-action - - uses: actions/checkout@v3 - - uses: hoverkraft-tech/compose-action@v1.5.1 - with: - compose-file: "./docker/docker-compose.yml" - services: | - helloworld2 - helloworld3 -``` diff --git a/.github/ghadocs/examples/3_up-flags.md b/.github/ghadocs/examples/3_up-flags.md deleted file mode 100644 index 24893c5..0000000 --- a/.github/ghadocs/examples/3_up-flags.md +++ /dev/null @@ -1,8 +0,0 @@ - - -### Example using `up-flags` - -Specify flags to pass to the `docker compose up`. Default is none. Can be used -to pass the `--build` flag, for example, if you want persistent volumes to be -deleted as well during cleanup. A full list of flags can be found in the -[Docker compose up documentation](https://docs.docker.com/compose/reference/up/). diff --git a/.github/ghadocs/examples/4_down-flags.md b/.github/ghadocs/examples/4_down-flags.md deleted file mode 100644 index 647af9d..0000000 --- a/.github/ghadocs/examples/4_down-flags.md +++ /dev/null @@ -1,9 +0,0 @@ - - -### Example using `down-flags` - -Specify flags to pass to the `docker-compose down` command during cleanup. -Default is none. Can be used to pass the `--volumes` flag, for example, if you -want persistent volumes to be deleted as well during cleanup. A full list of -flags can be found in the -[docker-compose down documentation](https://docs.docker.com/compose/reference/down/). diff --git a/.github/ghadocs/examples/5_compose-flags.md b/.github/ghadocs/examples/5_compose-flags.md deleted file mode 100644 index cfff662..0000000 --- a/.github/ghadocs/examples/5_compose-flags.md +++ /dev/null @@ -1,19 +0,0 @@ - - -### Example using `compose-flags` - -Specify flags to pass to the `docker compose` command. Default is none. A full -list of flags can be found in the -[Docker compose documentation](https://docs.docker.com/compose/reference/#command-options-overview-and-help). - -```yaml -steps: - # need checkout before using compose-action - - uses: actions/checkout@v3 - - uses: hoverkraft-tech/compose-action@v1.5.1 - with: - compose-file: "./docker/docker-compose.yml" - services: | - helloworld2 - helloworld3 -``` diff --git a/.github/ghadocs/examples/6_multiple-compose-files.md b/.github/ghadocs/examples/6_multiple-compose-files.md deleted file mode 100644 index 065618e..0000000 --- a/.github/ghadocs/examples/6_multiple-compose-files.md +++ /dev/null @@ -1,18 +0,0 @@ - - -### Example with multiple compose files - -Specify multiple compose files to use with the `docker compose` command. This is -useful when you have a base compose file and additional files for different -environments or configurations. - -```yaml -steps: - # need checkout before using compose-action - - uses: actions/checkout@v3 - - uses: hoverkraft-tech/compose-action@v1.5.1 - with: - compose-file: | - ./docker/docker-compose.yml - ./docker/docker-compose.ci.yml -``` diff --git a/.github/ghadocs/branding.svg b/.github/logo.svg similarity index 100% rename from .github/ghadocs/branding.svg rename to .github/logo.svg diff --git a/.github/ghadocs/social-preview.svg b/.github/social-preview.svg similarity index 100% rename from .github/ghadocs/social-preview.svg rename to .github/social-preview.svg diff --git a/.github/workflows/main-ci.yml b/.github/workflows/main-ci.yml index e6b221f..079775a 100644 --- a/.github/workflows/main-ci.yml +++ b/.github/workflows/main-ci.yml @@ -34,10 +34,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - uses: bitflight-devops/github-action-readme-generator@f750ff0ac8a4b68a3c2d622cc50a5ad20bcebaa1 # v1.8.0 + + - name: 📖 Generate documentation + uses: hoverkraft-tech/ci-dokumentor@002e0be35c188aa703fcc656d2db8f128800f723 # 0.1.0 with: - owner: ${{ github.repository_owner }} - repo: ${{ github.event.repository.name }} + source: action.yml - uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.1 id: generate-token diff --git a/Makefile b/Makefile index 232f6fd..7fdde58 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,8 @@ lint-fix: ## Execute linting and fix -e FIX_MARKDOWN_PRETTIER=true \ -e FIX_NATURAL_LANGUAGE=true) -all: ## Execute all formats and checks +ci: ## Execute all formats and checks + @npm install @npm audit fix @npm run all $(MAKE) lint-fix diff --git a/README.md b/README.md index 30e4f5c..139f4ed 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,31 @@ - -
docker-flags | Additional options to pass to Docker command. | | **false** |
-| compose-file | Path to compose file(s). It can be a list of files. It can be absolute or relative to the current working directory (cwd). | ./docker-compose.yml | **false** |
-| services | Services to perform Docker compose up. | | **false** |
-| up-flags | Additional options to pass to Docker compose up command. | | **false** |
-| down-flags | Additional options to pass to Docker compose down command. | | **false** |
-| compose-flags | Additional options to pass to Docker compose command. | | **false** |
-| cwd | Current working directory | ${{ github.workspace }} | **false** |
-| compose-version | Compose version to use.services-log-level | The log level used for Docker Compose service logs.debug | **false** |
-| github-token | The GitHub token used to create an authenticated client (to fetch the latest version of Docker compose). | ${{ github.token }} | **false** |
+
-
-
-
+
+
+
+
+
+
+
## Examples
@@ -143,7 +138,7 @@ jobs:
- uses: actions/checkout@v4.2.2
- name: Run docker compose
- uses: hoverkraft-tech/compose-action@v2.0.1
+ uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
with:
compose-file: "./docker/docker-compose.yml"
@@ -152,15 +147,12 @@ jobs:
docker compose exec test-app pytest
```
-
-
-
### Example Using environment variables
```yaml
steps:
- uses: actions/checkout@v4.2.2
- - uses: hoverkraft-tech/compose-action@v2.0.1
+ - uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
with:
compose-file: "./docker/docker-compose.yml"
env:
@@ -175,7 +167,7 @@ Perform `docker compose up` to some given service instead of all of them
steps:
# need checkout before using compose-action
- uses: actions/checkout@v3
- - uses: hoverkraft-tech/compose-action@v2.0.1
+ - uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
with:
compose-file: "./docker/docker-compose.yml"
services: |
@@ -185,30 +177,35 @@ steps:
### Example using `up-flags`
-Specify flags to pass to the `docker compose up`. Default is none. Can be used
-to pass the `--build` flag, for example, if you want persistent volumes to be
-deleted as well during cleanup. A full list of flags can be found in the
-[Docker compose up documentation](https://docs.docker.com/compose/reference/up/).
+Specify flags to pass to the `docker compose up`.
+
+Default is none.
+
+Can be used to pass the `--build` flag, for example, if you want persistent volumes to be deleted as well during cleanup.
+
+A full list of flags can be found in the [Docker compose up documentation](https://docs.docker.com/compose/reference/up/).
### Example using `down-flags`
Specify flags to pass to the `docker compose down` command during cleanup.
-Default is none. Can be used to pass the `--volumes` flag, for example, if you
-want persistent volumes to be deleted as well during cleanup. A full list of
-flags can be found in the
-[Docker compose down documentation](https://docs.docker.com/compose/reference/down/).
+
+Default is none.
+
+Can be used to pass the want persistent volumes to be deleted as well during cleanup.
+
+A full list of flags can be found in the [Docker compose down documentation](https://docs.docker.com/compose/reference/down/).
### Example using `compose-flags`
-Specify flags to pass to the `docker compose` command. Default is none. A full
-list of flags can be found in the
-[Docker compose documentation](https://docs.docker.com/compose/reference/#command-options-overview-and-help).
+Specify flags to pass to the `docker compose` command. Default is none.
+
+A full list of flags can be found in the [Docker compose documentation](https://docs.docker.com/compose/reference/#command-options-overview-and-help).
```yaml
steps:
# need checkout before using compose-action
- uses: actions/checkout@v3
- - uses: hoverkraft-tech/compose-action@v2.0.1
+ - uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
with:
compose-file: "./docker/docker-compose.yml"
services: |
@@ -216,19 +213,52 @@ steps:
helloworld3
```
-### Example with multiple compose files
+Specify multiple compose files to use with the `docker compose` command.
-Specify multiple compose files to use with the `docker compose` command. This is
-useful when you have a base compose file and additional files for different
-environments or configurations.
+This is useful when you have a base compose file and additional files for different environments or configurations.
```yaml
steps:
# need checkout before using compose-action
- uses: actions/checkout@v3
- - uses: hoverkraft-tech/compose-action@v1.5.1
+ - uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
with:
compose-file: |
./docker/docker-compose.yml
./docker/docker-compose.ci.yml
```
+
+
+
+
+
+## Contributing
+
+Contributions are welcome! Please see the [contributing guidelines](https://github.com/hoverkraft-tech/compose-action/blob/main/CONTRIBUTING.md) for more details.
+
+
+
+
+
+
+
+
+## License
+
+This project is licensed under the MIT License.
+
+SPDX-License-Identifier: MIT
+
+Copyright © 2025 hoverkraft
+
+For more details, see the [license](http://choosealicense.com/licenses/mit/).
+
+
+
+
+
+---
+
+This documentation was automatically generated by [CI Dokumentor](https://github.com/hoverkraft-tech/ci-dokumentor).
+
+
diff --git a/action.yml b/action.yml
index a2389f4..fd7a953 100644
--- a/action.yml
+++ b/action.yml
@@ -1,5 +1,23 @@
name: "Docker Compose Action"
-description: "This action runs your compose file(s) and clean up before action finished"
+description: |
+ This action runs your compose file(s) and clean up before action finished
+
+ ### Action
+
+ The action will run `docker compose up` to start the services defined in the given compose file(s).
+ The compose file(s) can be specified using the `compose-file` input.
+ Some extra options can be passed to the `docker compose up` command using the `up-flags` input.
+
+ ### Post hook
+
+ On post hook, the action will run `docker compose down` to clean up the services.
+
+ Logs of the Docker Compose services are logged using GitHub `core.ts` API before the cleanup.
+ The log level can be set using the `services-log-level` input.
+ The default is `debug`, which will only print logs if [debug mode](https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/troubleshooting-workflows/enabling-debug-logging) is switched on.
+
+ Some extra options can be passed to the `docker compose down` command using the `down-flags` input.
+
author: "hoverkraft"
branding:
icon: anchor
@@ -14,7 +32,7 @@ inputs:
required: false
default: "./docker-compose.yml"
services:
- description: "Services to perform docker compose up."
+ description: "Services to perform `docker compose up`."
required: false
up-flags:
description: "Additional options to pass to `docker compose up` command."
@@ -45,7 +63,7 @@ inputs:
required: false
default: "debug"
github-token:
- description: The GitHub token used to create an authenticated client (to fetch the latest version of docker compose).
+ description: The GitHub token used to create an authenticated client (to fetch the latest version of Docker Compose).
default: ${{ github.token }}
required: false
diff --git a/dist/index.js b/dist/index.js
index f04fcd3..349d5e9 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -33580,6 +33580,14 @@ module.exports = require("perf_hooks");
/***/ }),
+/***/ 932:
+/***/ ((module) => {
+
+"use strict";
+module.exports = require("process");
+
+/***/ }),
+
/***/ 3480:
/***/ ((module) => {
@@ -35365,8 +35373,8 @@ function composeCollection(CN, ctx, token, props, onError) {
tag = kt;
}
else {
- if (kt?.collection) {
- onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection}`, true);
+ if (kt) {
+ onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);
}
else {
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
@@ -35659,6 +35667,7 @@ exports.composeScalar = composeScalar;
"use strict";
+var node_process = __nccwpck_require__(932);
var directives = __nccwpck_require__(1342);
var Document = __nccwpck_require__(3021);
var errors = __nccwpck_require__(1464);
@@ -35792,7 +35801,7 @@ class Composer {
}
/** Advance the composer by one CST token. */
*next(token) {
- if (process.env.LOG_STREAM)
+ if (node_process.env.LOG_STREAM)
console.dir(token, { depth: null });
switch (token.type) {
case 'directive':
@@ -36834,7 +36843,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
if (atNewline) {
if (comment)
comment += token.source;
- else
+ else if (!found || indicator !== 'seq-item-ind')
spaceBefore = true;
}
else
@@ -36851,8 +36860,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
if (token.source.endsWith(':'))
onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
anchor = token;
- if (start === null)
- start = token.offset;
+ start ?? (start = token.offset);
atNewline = false;
hasSpace = false;
reqSpace = true;
@@ -36861,8 +36869,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
if (tag)
onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
tag = token;
- if (start === null)
- start = token.offset;
+ start ?? (start = token.offset);
atNewline = false;
hasSpace = false;
reqSpace = true;
@@ -36981,8 +36988,7 @@ exports.containsNewline = containsNewline;
function emptyScalarPosition(offset, before, pos) {
if (before) {
- if (pos === null)
- pos = before.length;
+ pos ?? (pos = before.length);
for (let i = pos - 1; i >= 0; --i) {
let st = before[i];
switch (st.type) {
@@ -37450,8 +37456,7 @@ function createNodeAnchors(doc, prefix) {
return {
onAnchor: (source) => {
aliasObjects.push(source);
- if (!prevAnchors)
- prevAnchors = anchorNames(doc);
+ prevAnchors ?? (prevAnchors = anchorNames(doc));
const anchor = findNewAnchor(prefix, prevAnchors);
prevAnchors.add(anchor);
return anchor;
@@ -37599,8 +37604,7 @@ function createNode(value, tagName, ctx) {
if (aliasDuplicateObjects && value && typeof value === 'object') {
ref = sourceObjects.get(value);
if (ref) {
- if (!ref.anchor)
- ref.anchor = onAnchor(value);
+ ref.anchor ?? (ref.anchor = onAnchor(value));
return new Alias.Alias(ref.anchor);
}
else {
@@ -37967,19 +37971,21 @@ exports.visitAsync = visit.visitAsync;
/***/ }),
/***/ 7249:
-/***/ ((__unused_webpack_module, exports) => {
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
+var node_process = __nccwpck_require__(932);
+
function debug(logLevel, ...messages) {
if (logLevel === 'debug')
console.log(...messages);
}
function warn(logLevel, warning) {
if (logLevel === 'debug' || logLevel === 'warn') {
- if (typeof process !== 'undefined' && process.emitWarning)
- process.emitWarning(warning);
+ if (typeof node_process.emitWarning === 'function')
+ node_process.emitWarning(warning);
else
console.warn(warning);
}
@@ -38017,23 +38023,36 @@ class Alias extends Node.NodeBase {
* Resolve the value of this alias within `doc`, finding the last
* instance of the `source` anchor before this node.
*/
- resolve(doc) {
+ resolve(doc, ctx) {
+ let nodes;
+ if (ctx?.aliasResolveCache) {
+ nodes = ctx.aliasResolveCache;
+ }
+ else {
+ nodes = [];
+ visit.visit(doc, {
+ Node: (_key, node) => {
+ if (identity.isAlias(node) || identity.hasAnchor(node))
+ nodes.push(node);
+ }
+ });
+ if (ctx)
+ ctx.aliasResolveCache = nodes;
+ }
let found = undefined;
- visit.visit(doc, {
- Node: (_key, node) => {
- if (node === this)
- return visit.visit.BREAK;
- if (node.anchor === this.source)
- found = node;
- }
- });
+ for (const node of nodes) {
+ if (node === this)
+ break;
+ if (node.anchor === this.source)
+ found = node;
+ }
return found;
}
toJSON(_arg, ctx) {
if (!ctx)
return { source: this.source };
const { anchors, doc, maxAliasCount } = ctx;
- const source = this.resolve(doc);
+ const source = this.resolve(doc, ctx);
if (!source) {
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
throw new ReferenceError(msg);
@@ -38714,6 +38733,7 @@ function addPairToJSMap(ctx, map, { key, value }) {
function stringifyKey(key, jsKey, ctx) {
if (jsKey === null)
return '';
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
if (typeof jsKey !== 'object')
return String(jsKey);
if (identity.isNode(key) && ctx?.doc) {
@@ -40155,6 +40175,7 @@ exports.LineCounter = LineCounter;
"use strict";
+var node_process = __nccwpck_require__(932);
var cst = __nccwpck_require__(3461);
var lexer = __nccwpck_require__(361);
@@ -40321,7 +40342,7 @@ class Parser {
*/
*next(source) {
this.source = source;
- if (process.env.LOG_TOKENS)
+ if (node_process.env.LOG_TOKENS)
console.log('|', cst.prettyToken(source));
if (this.atScalar) {
this.atScalar = false;
@@ -40827,7 +40848,20 @@ class Parser {
default: {
const bv = this.startBlockValue(map);
if (bv) {
- if (atMapIndent && bv.type !== 'block-seq') {
+ if (bv.type === 'block-seq') {
+ if (!it.explicitKey &&
+ it.sep &&
+ !includesToken(it.sep, 'newline')) {
+ yield* this.pop({
+ type: 'error',
+ offset: this.offset,
+ message: 'Unexpected block-seq-ind on same line with key',
+ source: this.source
+ });
+ return;
+ }
+ }
+ else if (atMapIndent) {
map.items.push({ start });
}
this.stack.push(bv);
@@ -41732,6 +41766,7 @@ exports.getTags = getTags;
"use strict";
+var node_buffer = __nccwpck_require__(181);
var Scalar = __nccwpck_require__(3301);
var stringifyString = __nccwpck_require__(3069);
@@ -41748,8 +41783,8 @@ const binary = {
* document.querySelector('#photo').src = URL.createObjectURL(blob)
*/
resolve(src, onError) {
- if (typeof Buffer === 'function') {
- return Buffer.from(src, 'base64');
+ if (typeof node_buffer.Buffer === 'function') {
+ return node_buffer.Buffer.from(src, 'base64');
}
else if (typeof atob === 'function') {
// On IE 11, atob() can't handle newlines
@@ -41765,13 +41800,15 @@ const binary = {
}
},
stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
+ if (!value)
+ return '';
const buf = value; // checked earlier by binary.identify()
let str;
- if (typeof Buffer === 'function') {
+ if (typeof node_buffer.Buffer === 'function') {
str =
- buf instanceof Buffer
+ buf instanceof node_buffer.Buffer
? buf.toString('base64')
- : Buffer.from(buf.buffer).toString('base64');
+ : node_buffer.Buffer.from(buf.buffer).toString('base64');
}
else if (typeof btoa === 'function') {
let s = '';
@@ -41782,8 +41819,7 @@ const binary = {
else {
throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
}
- if (!type)
- type = Scalar.Scalar.BLOCK_LITERAL;
+ type ?? (type = Scalar.Scalar.BLOCK_LITERAL);
if (type !== Scalar.Scalar.QUOTE_DOUBLE) {
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
const n = Math.ceil(str.length / lineWidth);
@@ -42488,7 +42524,7 @@ const timestamp = {
}
return new Date(date);
},
- stringify: ({ value }) => value.toISOString().replace(/(T00:00:00)?\.000Z$/, '')
+ stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, '') ?? ''
};
exports.floatTime = floatTime;
@@ -42733,7 +42769,7 @@ function getTagObject(tags, item) {
tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
}
if (!tagObj) {
- const name = obj?.constructor?.name ?? typeof obj;
+ const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);
throw new Error(`Tag not resolved for ${name} value`);
}
return tagObj;
@@ -42748,7 +42784,7 @@ function stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {
anchors$1.add(anchor);
props.push(`&${anchor}`);
}
- const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
+ const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
if (tag)
props.push(doc.directives.tagString(tag));
return props.join(' ');
@@ -42774,8 +42810,7 @@ function stringify(item, ctx, onComment, onChompKeep) {
const node = identity.isNode(item)
? item
: ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
- if (!tagObj)
- tagObj = getTagObject(ctx.doc.schema.tags, node);
+ tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
const props = stringifyProps(node, tagObj, ctx);
if (props.length > 0)
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
@@ -43438,7 +43473,7 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
const { blockQuote, commentString, lineWidth } = ctx.options;
// 1. Block can't end in whitespace unless the last line is non-empty.
// 2. Strings consisting of only whitespace are best rendered explicitly.
- if (!blockQuote || /\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
+ if (!blockQuote || /\n[\t ]+$/.test(value)) {
return quotedString(value, ctx);
}
const indent = ctx.indent ||
@@ -43532,10 +43567,9 @@ function plainString(item, ctx, onComment, onChompKeep) {
(inFlow && /[[\]{},]/.test(value))) {
return quotedString(value, ctx);
}
- if (!value ||
- /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
+ if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
// not allowed:
- // - empty string, '-' or '?'
+ // - '-' or '?'
// - start with an indicator character (except [?:-]) or /[?-] /
// - '\n ', ': ' or ' \n' anywhere
// - '#' not preceded by a non-space char
@@ -43911,7 +43945,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
* The entrypoint for the action.
*/
const index_runner_1 = __nccwpck_require__(5310);
-// eslint-disable-next-line @typescript-eslint/no-floating-promises
(0, index_runner_1.run)();
})();
diff --git a/dist/post.js b/dist/post.js
index be39b21..75facb0 100644
--- a/dist/post.js
+++ b/dist/post.js
@@ -26597,6 +26597,14 @@ module.exports = require("perf_hooks");
/***/ }),
+/***/ 932:
+/***/ ((module) => {
+
+"use strict";
+module.exports = require("process");
+
+/***/ }),
+
/***/ 3480:
/***/ ((module) => {
@@ -28382,8 +28390,8 @@ function composeCollection(CN, ctx, token, props, onError) {
tag = kt;
}
else {
- if (kt?.collection) {
- onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection}`, true);
+ if (kt) {
+ onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);
}
else {
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
@@ -28676,6 +28684,7 @@ exports.composeScalar = composeScalar;
"use strict";
+var node_process = __nccwpck_require__(932);
var directives = __nccwpck_require__(1342);
var Document = __nccwpck_require__(3021);
var errors = __nccwpck_require__(1464);
@@ -28809,7 +28818,7 @@ class Composer {
}
/** Advance the composer by one CST token. */
*next(token) {
- if (process.env.LOG_STREAM)
+ if (node_process.env.LOG_STREAM)
console.dir(token, { depth: null });
switch (token.type) {
case 'directive':
@@ -29851,7 +29860,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
if (atNewline) {
if (comment)
comment += token.source;
- else
+ else if (!found || indicator !== 'seq-item-ind')
spaceBefore = true;
}
else
@@ -29868,8 +29877,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
if (token.source.endsWith(':'))
onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
anchor = token;
- if (start === null)
- start = token.offset;
+ start ?? (start = token.offset);
atNewline = false;
hasSpace = false;
reqSpace = true;
@@ -29878,8 +29886,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
if (tag)
onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
tag = token;
- if (start === null)
- start = token.offset;
+ start ?? (start = token.offset);
atNewline = false;
hasSpace = false;
reqSpace = true;
@@ -29998,8 +30005,7 @@ exports.containsNewline = containsNewline;
function emptyScalarPosition(offset, before, pos) {
if (before) {
- if (pos === null)
- pos = before.length;
+ pos ?? (pos = before.length);
for (let i = pos - 1; i >= 0; --i) {
let st = before[i];
switch (st.type) {
@@ -30467,8 +30473,7 @@ function createNodeAnchors(doc, prefix) {
return {
onAnchor: (source) => {
aliasObjects.push(source);
- if (!prevAnchors)
- prevAnchors = anchorNames(doc);
+ prevAnchors ?? (prevAnchors = anchorNames(doc));
const anchor = findNewAnchor(prefix, prevAnchors);
prevAnchors.add(anchor);
return anchor;
@@ -30616,8 +30621,7 @@ function createNode(value, tagName, ctx) {
if (aliasDuplicateObjects && value && typeof value === 'object') {
ref = sourceObjects.get(value);
if (ref) {
- if (!ref.anchor)
- ref.anchor = onAnchor(value);
+ ref.anchor ?? (ref.anchor = onAnchor(value));
return new Alias.Alias(ref.anchor);
}
else {
@@ -30984,19 +30988,21 @@ exports.visitAsync = visit.visitAsync;
/***/ }),
/***/ 7249:
-/***/ ((__unused_webpack_module, exports) => {
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
+var node_process = __nccwpck_require__(932);
+
function debug(logLevel, ...messages) {
if (logLevel === 'debug')
console.log(...messages);
}
function warn(logLevel, warning) {
if (logLevel === 'debug' || logLevel === 'warn') {
- if (typeof process !== 'undefined' && process.emitWarning)
- process.emitWarning(warning);
+ if (typeof node_process.emitWarning === 'function')
+ node_process.emitWarning(warning);
else
console.warn(warning);
}
@@ -31034,23 +31040,36 @@ class Alias extends Node.NodeBase {
* Resolve the value of this alias within `doc`, finding the last
* instance of the `source` anchor before this node.
*/
- resolve(doc) {
+ resolve(doc, ctx) {
+ let nodes;
+ if (ctx?.aliasResolveCache) {
+ nodes = ctx.aliasResolveCache;
+ }
+ else {
+ nodes = [];
+ visit.visit(doc, {
+ Node: (_key, node) => {
+ if (identity.isAlias(node) || identity.hasAnchor(node))
+ nodes.push(node);
+ }
+ });
+ if (ctx)
+ ctx.aliasResolveCache = nodes;
+ }
let found = undefined;
- visit.visit(doc, {
- Node: (_key, node) => {
- if (node === this)
- return visit.visit.BREAK;
- if (node.anchor === this.source)
- found = node;
- }
- });
+ for (const node of nodes) {
+ if (node === this)
+ break;
+ if (node.anchor === this.source)
+ found = node;
+ }
return found;
}
toJSON(_arg, ctx) {
if (!ctx)
return { source: this.source };
const { anchors, doc, maxAliasCount } = ctx;
- const source = this.resolve(doc);
+ const source = this.resolve(doc, ctx);
if (!source) {
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
throw new ReferenceError(msg);
@@ -31731,6 +31750,7 @@ function addPairToJSMap(ctx, map, { key, value }) {
function stringifyKey(key, jsKey, ctx) {
if (jsKey === null)
return '';
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
if (typeof jsKey !== 'object')
return String(jsKey);
if (identity.isNode(key) && ctx?.doc) {
@@ -33172,6 +33192,7 @@ exports.LineCounter = LineCounter;
"use strict";
+var node_process = __nccwpck_require__(932);
var cst = __nccwpck_require__(3461);
var lexer = __nccwpck_require__(361);
@@ -33338,7 +33359,7 @@ class Parser {
*/
*next(source) {
this.source = source;
- if (process.env.LOG_TOKENS)
+ if (node_process.env.LOG_TOKENS)
console.log('|', cst.prettyToken(source));
if (this.atScalar) {
this.atScalar = false;
@@ -33844,7 +33865,20 @@ class Parser {
default: {
const bv = this.startBlockValue(map);
if (bv) {
- if (atMapIndent && bv.type !== 'block-seq') {
+ if (bv.type === 'block-seq') {
+ if (!it.explicitKey &&
+ it.sep &&
+ !includesToken(it.sep, 'newline')) {
+ yield* this.pop({
+ type: 'error',
+ offset: this.offset,
+ message: 'Unexpected block-seq-ind on same line with key',
+ source: this.source
+ });
+ return;
+ }
+ }
+ else if (atMapIndent) {
map.items.push({ start });
}
this.stack.push(bv);
@@ -34749,6 +34783,7 @@ exports.getTags = getTags;
"use strict";
+var node_buffer = __nccwpck_require__(181);
var Scalar = __nccwpck_require__(3301);
var stringifyString = __nccwpck_require__(3069);
@@ -34765,8 +34800,8 @@ const binary = {
* document.querySelector('#photo').src = URL.createObjectURL(blob)
*/
resolve(src, onError) {
- if (typeof Buffer === 'function') {
- return Buffer.from(src, 'base64');
+ if (typeof node_buffer.Buffer === 'function') {
+ return node_buffer.Buffer.from(src, 'base64');
}
else if (typeof atob === 'function') {
// On IE 11, atob() can't handle newlines
@@ -34782,13 +34817,15 @@ const binary = {
}
},
stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
+ if (!value)
+ return '';
const buf = value; // checked earlier by binary.identify()
let str;
- if (typeof Buffer === 'function') {
+ if (typeof node_buffer.Buffer === 'function') {
str =
- buf instanceof Buffer
+ buf instanceof node_buffer.Buffer
? buf.toString('base64')
- : Buffer.from(buf.buffer).toString('base64');
+ : node_buffer.Buffer.from(buf.buffer).toString('base64');
}
else if (typeof btoa === 'function') {
let s = '';
@@ -34799,8 +34836,7 @@ const binary = {
else {
throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
}
- if (!type)
- type = Scalar.Scalar.BLOCK_LITERAL;
+ type ?? (type = Scalar.Scalar.BLOCK_LITERAL);
if (type !== Scalar.Scalar.QUOTE_DOUBLE) {
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
const n = Math.ceil(str.length / lineWidth);
@@ -35505,7 +35541,7 @@ const timestamp = {
}
return new Date(date);
},
- stringify: ({ value }) => value.toISOString().replace(/(T00:00:00)?\.000Z$/, '')
+ stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, '') ?? ''
};
exports.floatTime = floatTime;
@@ -35750,7 +35786,7 @@ function getTagObject(tags, item) {
tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
}
if (!tagObj) {
- const name = obj?.constructor?.name ?? typeof obj;
+ const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);
throw new Error(`Tag not resolved for ${name} value`);
}
return tagObj;
@@ -35765,7 +35801,7 @@ function stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {
anchors$1.add(anchor);
props.push(`&${anchor}`);
}
- const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
+ const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
if (tag)
props.push(doc.directives.tagString(tag));
return props.join(' ');
@@ -35791,8 +35827,7 @@ function stringify(item, ctx, onComment, onChompKeep) {
const node = identity.isNode(item)
? item
: ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
- if (!tagObj)
- tagObj = getTagObject(ctx.doc.schema.tags, node);
+ tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
const props = stringifyProps(node, tagObj, ctx);
if (props.length > 0)
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
@@ -36455,7 +36490,7 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
const { blockQuote, commentString, lineWidth } = ctx.options;
// 1. Block can't end in whitespace unless the last line is non-empty.
// 2. Strings consisting of only whitespace are best rendered explicitly.
- if (!blockQuote || /\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
+ if (!blockQuote || /\n[\t ]+$/.test(value)) {
return quotedString(value, ctx);
}
const indent = ctx.indent ||
@@ -36549,10 +36584,9 @@ function plainString(item, ctx, onComment, onChompKeep) {
(inFlow && /[[\]{},]/.test(value))) {
return quotedString(value, ctx);
}
- if (!value ||
- /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
+ if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
// not allowed:
- // - empty string, '-' or '?'
+ // - '-' or '?'
// - start with an indicator character (except [?:-]) or /[?-] /
// - '\n ', ': ' or ' \n' anywhere
// - '#' not preceded by a non-space char
@@ -36928,7 +36962,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
* The entrypoint for the post action.
*/
const post_runner_1 = __nccwpck_require__(7080);
-// eslint-disable-next-line @typescript-eslint/no-floating-promises
(0, post_runner_1.run)();
})();
diff --git a/src/index.ts b/src/index.ts
index 4fd696c..37e0a96 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -3,5 +3,4 @@
*/
import { run } from "./index-runner";
-// eslint-disable-next-line @typescript-eslint/no-floating-promises
run();
diff --git a/src/post.ts b/src/post.ts
index 34cfee1..7377c4a 100644
--- a/src/post.ts
+++ b/src/post.ts
@@ -3,5 +3,4 @@
*/
import { run } from "./post-runner";
-// eslint-disable-next-line @typescript-eslint/no-floating-promises
run();
diff --git a/src/services/docker-compose.service.test.ts b/src/services/docker-compose.service.test.ts
index 8ba985e..9564d77 100644
--- a/src/services/docker-compose.service.test.ts
+++ b/src/services/docker-compose.service.test.ts
@@ -53,7 +53,10 @@ describe("DockerComposeService", () => {
expect(callback).toBeDefined();
const message = "test log output";
- callback ? callback(Buffer.from(message)) : null;
+
+ if (callback) {
+ callback(Buffer.from(message));
+ }
expect(upInputs.serviceLogger).toHaveBeenCalledWith("test log output");
});