Skip to content
This repository was archived by the owner on Mar 6, 2021. It is now read-only.

Commit 2ab6fc6

Browse files
committed
Fix: Allow specifying arguments
1 parent 50ec753 commit 2ab6fc6

File tree

6 files changed

+46
-38
lines changed

6 files changed

+46
-38
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ jobs:
2424
- name: "Run Docker image with default behaviour"
2525
run: "docker run --interactive --rm --workdir=/app --volume ${GITHUB_WORKSPACE}/.build:/app ${{ env.DOCKER_IMAGE }}:latest"
2626

27-
- name: "Run Docker image with custom behaviour"
28-
run: "docker run --interactive --rm --workdir=/app --volume ${GITHUB_WORKSPACE}/.build:/app ${{ env.DOCKER_IMAGE }}:latest --indent-size=1 --indent-style=tab --no-update-lock"
27+
- name: "Run Docker image with custom behaviour, specifying options"
28+
run: "docker run --interactive --rm --workdir=/app --volume ${GITHUB_WORKSPACE}/.build:/app ${{ env.DOCKER_IMAGE }}:latest --diff --indent-size=1 --indent-style=tab --no-update-lock"
29+
30+
- name: "Run Docker image with custom behaviour, specifying argument and options"
31+
run: "docker run --interactive --rm --workdir=/app --volume ${GITHUB_WORKSPACE}:/app ${{ env.DOCKER_IMAGE }}:latest .build/composer.json --dry-run --indent-size=2 --indent-style=space --no-update-lock"
2932

3033
run:
3134
name: "Run"
@@ -45,7 +48,15 @@ jobs:
4548
- name: "Run composer-normalize-action with default behavior"
4649
uses: "./"
4750

48-
- name: "Run composer-normalize-action with custom behavior"
51+
- name: "Run composer-normalize-action with custom behavior, specifying options"
52+
uses: "./"
53+
with:
54+
args: "--diff --indent-size=1 --indent-style=tab --no-update-lock"
55+
56+
- name: "Remove composer.json from root directory"
57+
run: "rm composer.json"
58+
59+
- name: "Run composer-normalize-action with custom behavior, specifying argument and options"
4960
uses: "./"
5061
with:
51-
args: "--indent-size=1 --indent-style=tab --no-update-lock"
62+
args: ".build/composer.json --diff --indent-size=1 --indent-style=tab --no-update-lock"

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ For a full diff see [`0.6.0...master`][0.6.0...master].
1212

1313
* Removed possibility to configure version of `ergebnis/composer-normalize` via `COMPOSER_NORMALIZE_VERSION` environment variable ([#63]), by [@localheinz]
1414

15+
### Fixed
16+
17+
* Allowed specifying arguments and options so action can be run in other modes ([#64]), by [@localheinz]
18+
1519
## [`0.6.0`][0.6.0]
1620

1721
For a full diff see [`0.5.2...0.6.0`][0.5.2...0.6.0].
@@ -195,6 +199,7 @@ For a full diff see [`afa2393...0.1.0`][afa2393...0.1.0].
195199
[#57]: https://github.com/ergebnis/composer-normalize-action/pull/57
196200
[#59]: https://github.com/ergebnis/composer-normalize-action/pull/59
197201
[#63]: https://github.com/ergebnis/composer-normalize-action/pull/63
202+
[#64]: https://github.com/ergebnis/composer-normalize-action/pull/64
198203

199204
[@localheinz]: https://github.com/localheinz
200205
[@ergebnis]: https://github.com/localheinz

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ ENV COMPOSER_ALLOW_SUPERUSER=1
1010

1111
RUN composer global require ergebnis/composer-normalize:2.2.0 --no-interaction --no-progress --no-suggest
1212

13-
ADD entrypoint.sh /entrypoint.sh
13+
RUN mkdir /app
1414

15-
ENTRYPOINT ["/entrypoint.sh"]
15+
WORKDIR /app
16+
17+
ENTRYPOINT ["/usr/local/bin/composer", "normalize"]
18+
19+
CMD ["--dry-run"]

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ it: docker ## Runs the docker target
77
docker: ## Builds, tags, and runs the Docker image
88
docker build --tag ${DOCKER_IMAGE} .
99
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}/.build:/app ${DOCKER_IMAGE}:latest
10+
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}/.build:/app ${DOCKER_IMAGE}:latest --diff --indent-size=1 --indent-style=space --no-update-lock
11+
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}:/app ${DOCKER_IMAGE}:latest .build/composer.json --diff --indent-size=2 --indent-style=space --no-update-lock
1012

1113
help: ## Displays this list of targets with descriptions
1214
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'

README.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,24 @@ When you use this action in a step with the default behaviour, the step will fai
3232
Here's an example for a workflow configuration with the default behaviour:
3333

3434
```yaml
35-
name: Continuous Integration
35+
name: "Continuous Integration"
3636

37-
on: push
37+
on: "push"
3838

3939
jobs:
4040
composer-normalize:
41-
name: composer-normalize
41+
name: "composer-normalize"
4242

43-
runs-on: ubuntu-latest
43+
runs-on: "ubuntu-latest"
4444

4545
steps:
4646
- name: "Checkout"
47-
uses: actions/checkout@master
47+
uses: "actions/checkout@v2.0.0"
4848

4949
- name: "Run composer normalize"
50-
uses: docker://ergebnis/composer-normalize-action:latest
50+
uses: "docker://ergebnis/composer-normalize-action:latest"
5151
```
5252
53-
:bulb: Here
5453
To see this action in action, take a look at the following checks:
5554
5655
* https://github.com/ergebnis/composer-normalize-action-example/pull/1/checks
@@ -62,24 +61,24 @@ To see this action in action, take a look at the following checks:
6261
If you prefer to specify [arguments](https://github.com/ergebnis/composer-normalize/tree/master#arguments) or [options](https://github.com/ergebnis/composer-normalize/master#options) yourself, you can configure those using the `args` option:
6362

6463
```diff
65-
name: Continuous Integration
64+
name: "Continuous Integration"
6665
67-
on: push
66+
on: "push"
6867
6968
jobs:
7069
composer-normalize:
71-
name: composer-normalize
70+
name: "composer-normalize"
7271
73-
runs-on: ubuntu-latest
72+
runs-on: "ubuntu-latest"
7473
7574
steps:
7675
- name: "Checkout"
77-
uses: actions/checkout@master
76+
uses: "actions/checkout@v2.0.0"
7877
7978
- name: "Run composer normalize"
80-
uses: docker://ergebnis/composer-normalize-action:latest
79+
uses: "docker://ergebnis/composer-normalize-action:latest"
8180
+ with:
82-
+ args: ./sub-directory/composer.json --dry-run
81+
+ args: "normalize ./sub-directory/composer.json"
8382
```
8483

8584
### Docker image
@@ -103,17 +102,17 @@ Instead of using the latest pre-built Docker image, you can also specify a Docke
103102
104103
jobs:
105104
composer-normalize:
106-
name: composer-normalize
105+
name: "composer-normalize"
107106
108-
runs-on: ubuntu-latest
107+
runs-on: "ubuntu-latest"
109108
110109
steps:
111110
- name: "Checkout"
112-
uses: actions/checkout@master
111+
uses: "actions/checkout@v2.0.0"
113112
114113
- name: "Run composer normalize"
115-
- uses: docker://ergebnis/composer-normalize-action:latest
116-
+ uses: docker://ergebnis/composer-normalize-action:0.4.2
114+
- uses: "docker://ergebnis/composer-normalize-action:latest"
115+
+ uses: "docker://ergebnis/composer-normalize-action:0.6.0"
117116
```
118117

119118
## Changelog

entrypoint.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)