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

Fix: Allow specifying arguments #64

Merged
merged 1 commit into from
Jan 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ jobs:
- name: "Run Docker image with default behaviour"
run: "docker run --interactive --rm --workdir=/app --volume ${GITHUB_WORKSPACE}/.build:/app ${{ env.DOCKER_IMAGE }}:latest"

- name: "Run Docker image with custom behaviour"
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"
- name: "Run Docker image with custom behaviour, specifying options"
run: "docker run --interactive --rm --workdir=/app --volume ${GITHUB_WORKSPACE}/.build:/app ${{ env.DOCKER_IMAGE }}:latest --diff --indent-size=1 --indent-style=space --no-update-lock"

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

run:
name: "Run"
Expand All @@ -45,7 +48,15 @@ jobs:
- name: "Run composer-normalize-action with default behavior"
uses: "./"

- name: "Run composer-normalize-action with custom behavior"
- name: "Run composer-normalize-action with custom behavior, specifying options"
uses: "./"
with:
args: "--diff --indent-size=1 --indent-style=tab --no-update-lock"

- name: "Remove composer.json from root directory"
run: "rm composer.json"

- name: "Run composer-normalize-action with custom behavior, specifying argument and options"
uses: "./"
with:
args: "--indent-size=1 --indent-style=tab --no-update-lock"
args: ".build/composer.json --diff --indent-size=1 --indent-style=tab --no-update-lock"
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ For a full diff see [`0.6.0...master`][0.6.0...master].

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

### Fixed

* Allowed specifying arguments and options so action can be run in other modes ([#64]), by [@localheinz]

## [`0.6.0`][0.6.0]

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

[@localheinz]: https://github.com/localheinz
[@ergebnis]: https://github.com/localheinz
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ ENV COMPOSER_ALLOW_SUPERUSER=1

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

ADD entrypoint.sh /entrypoint.sh
RUN mkdir /app

ENTRYPOINT ["/entrypoint.sh"]
WORKDIR /app

ENTRYPOINT ["/usr/local/bin/composer", "normalize"]

CMD ["--dry-run"]
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ it: docker ## Runs the docker target
docker: ## Builds, tags, and runs the Docker image
docker build --tag ${DOCKER_IMAGE} .
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}/.build:/app ${DOCKER_IMAGE}:latest
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}/.build:/app ${DOCKER_IMAGE}:latest --diff --indent-size=1 --indent-style=space --no-update-lock
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

help: ## Displays this list of targets with descriptions
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'
37 changes: 18 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,24 @@ When you use this action in a step with the default behaviour, the step will fai
Here's an example for a workflow configuration with the default behaviour:

```yaml
name: Continuous Integration
name: "Continuous Integration"

on: push
on: "push"

jobs:
composer-normalize:
name: composer-normalize
name: "composer-normalize"

runs-on: ubuntu-latest
runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
uses: actions/checkout@master
uses: "actions/checkout@v2.0.0"

- name: "Run composer normalize"
uses: docker://ergebnis/composer-normalize-action:latest
uses: "docker://ergebnis/composer-normalize-action:latest"
```

:bulb: Here
To see this action in action, take a look at the following checks:

* https://github.com/ergebnis/composer-normalize-action-example/pull/1/checks
Expand All @@ -62,24 +61,24 @@ To see this action in action, take a look at the following checks:
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:

```diff
name: Continuous Integration
name: "Continuous Integration"

on: push
on: "push"

jobs:
composer-normalize:
name: composer-normalize
name: "composer-normalize"

runs-on: ubuntu-latest
runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
uses: actions/checkout@master
uses: "actions/checkout@v2.0.0"

- name: "Run composer normalize"
uses: docker://ergebnis/composer-normalize-action:latest
uses: "docker://ergebnis/composer-normalize-action:latest"
+ with:
+ args: ./sub-directory/composer.json --dry-run
+ args: "normalize ./sub-directory/composer.json"
```

### Docker image
Expand All @@ -103,17 +102,17 @@ Instead of using the latest pre-built Docker image, you can also specify a Docke

jobs:
composer-normalize:
name: composer-normalize
name: "composer-normalize"

runs-on: ubuntu-latest
runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
uses: actions/checkout@master
uses: "actions/checkout@v2.0.0"

- name: "Run composer normalize"
- uses: docker://ergebnis/composer-normalize-action:latest
+ uses: docker://ergebnis/composer-normalize-action:0.4.2
- uses: "docker://ergebnis/composer-normalize-action:latest"
+ uses: "docker://ergebnis/composer-normalize-action:0.6.0"
```

## Changelog
Expand Down
13 changes: 0 additions & 13 deletions entrypoint.sh

This file was deleted.