Skip to content

Commit 1c8eb83

Browse files
committed
Use correct syntax for empty YAML sequence
Unlike the other inputs (`platforms`, `sketch-paths`) that take a "sequence" (AKA array, list) type YAML document as input, because a sketch may have no library dependencies it is valid and common to pass an empty sequence via the `libraries` input. Due to the need to maintain backwards compatibility with the original short-sighted design of the action API, which didn't consider the action being used with any project type other than libraries, it is necessary for the user to do this in their workflow rather than simply omitting the `libraries` input. Previously the documentation and tests used "-" for this purpose. That is supported, but is not an empty sequence, but rather a sequence consisting of a single null element. The only way to specify an empty sequence in YAML is `[]`.
1 parent 9086e7c commit 1c8eb83

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

.github/workflows/test-integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
libraries: |
7373
# The official Servo library is not compatible with ESP8266, but that platform has a bundled Servo lib
7474
# so there are no library dependencies
75-
-
75+
[]
7676
7777
steps:
7878
- name: Checkout
@@ -348,7 +348,7 @@ jobs:
348348
fqbn: arduino:avr:uno
349349
github-token: ${{ secrets.GITHUB_TOKEN }}
350350
libraries: |
351-
-
351+
[]
352352
sketch-paths: |
353353
- ${{ env.TESTDATA_SKETCHES_PATH }}/Error
354354

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Keys:
129129
[YAML](https://en.wikipedia.org/wiki/YAML)-format list of library dependencies to install.
130130

131131
**Default**: `"- source-path: ./"`
132-
This causes the repository to be installed as a library. If there are no library dependencies and you want to override the default, set the `libraries` input to an empty list (`- libraries: '-'`).
132+
This causes the repository to be installed as a library. If there are no library dependencies and you want to override the default, set the `libraries` input to an empty list (`- libraries: '[]'`).
133133
134134
Libraries are installed under the Arduino user folder at `~/Arduino/libraries`.
135135

compilesketches/tests/test_compilesketches.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,7 @@ def __init__(self):
10701070
[],
10711071
),
10721072
("-", [], [], [], []),
1073+
("[]", [], [], [], []),
10731074
(
10741075
"- " + compilesketches.CompileSketches.dependency_name_key + ": foo",
10751076
[{compilesketches.CompileSketches.dependency_name_key: "foo"}],

0 commit comments

Comments
 (0)