A GitHub Action that reads one or more Java-style .properties files and
exposes every key-value pair as a step output.
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Read config
id: props
uses: ActionCommons/read-properties-action@v1
with:
files: config/app.properties
- name: Use a value
run: echo "${{ steps.props.outputs['app.version'] }}"- name: Read multiple files
id: props
uses: ActionCommons/read-properties-action@v1
with:
files: |
config/database.properties
config/app.propertiesThe properties filter applies to every file listed in files.
- name: Read selected properties
id: props
uses: ActionCommons/read-properties-action@v1
with:
files: |
config/database.properties
config/app.properties
properties: |
db.host
app.version| Input | Required | Description |
|---|---|---|
files |
Yes | Newline-separated list of one or more .properties file paths |
properties |
No | Newline-separated list of property keys to read. When omitted, all properties are read. |
Outputs are set dynamically at runtime as <stem>.<property-key>, where stem
is the filename without its extension.
| Example file | Example property | Output key |
|---|---|---|
config.properties |
db.host |
config.db.host |
app.properties |
version |
app.version |
Because output keys contain dots, use bracket notation:
${{ steps.props.outputs['config.db.host'] }}When two files share the same name (but live in different directories), the first keeps the plain stem and each subsequent file receives a 1-based numeric suffix:
| File | Stem assigned |
|---|---|
env/prod/config.properties |
config |
env/staging/config.properties |
config1 |
env/dev/config.properties |
config2 |
| Feature | Supported |
|---|---|
key=value assignment |
✅ |
key: value (colon separator) |
✅ |
# and ! comment lines |
✅ |
| Backslash line continuation | ✅ |
| Spaces around the separator | ✅ |
= signs inside values |
✅ |
Empty values (key=) |
✅ |
| Windows CRLF line endings | ✅ |
Copy .env.example to .env and set your input values, then run:
npx @github/local-action . src/main.ts .envInput names follow the INPUT_<NAME> convention (hyphens are not converted
to underscores):
# .env
ACTIONS_STEP_DEBUG=true
INPUT_FILES=config/app.properties
INPUT_PROPERTIES=app.version