Skip to content

Commit

Permalink
Merge pull request #7 from twof/dockerSupport
Browse files Browse the repository at this point in the history
Docker support
  • Loading branch information
twof committed Dec 27, 2021
2 parents dbf47c7 + cfcabf1 commit 026568f
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 12 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,22 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- id: file_changes
uses: trilom/file-changes-action@v1.2.3
- uses: actions/checkout@v2.4.0
with:
output: ' '
fetch-depth: 0
- uses: actions/setup-python@v2
- name: Get changed files
id: changes
# Set outputs using the command.
run: |
echo "::set-output name=all::$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | xargs)"
- id: pre_commit_action
uses: pre-commit/action@v2.0.0
uses: pre-commit/action@v2.0.3
with:
extra_args: downstream --files ${{ steps.file_changes.outputs.files }};
extra_args: --files ${{ steps.changes.outputs.all }}
- id: get_changes
run: |
content="$(swift run downstream -o human ${{ steps.file_changes.outputs.files }})"
content="$(swift run downstream -o human ${{ steps.changes.outputs.all }})"
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
Expand Down
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
repos:
- repo: .
rev: HEAD
rev: 8a0a3b129b0d87bdc046b68dddb1c29bd9f708d1
hooks:
- id: downstream
- id: downstream-docker
7 changes: 7 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
---
- id: downstream
name: Downstream
description: Alerts the user to downstream dependencies of the files updated
entry: downstream
language: swift
verbose: true
- id: downstream-docker
name: DownstreamDocker
description: Alerts the user to downstream dependencies of the files updated
entry: downstream
language: docker
verbose: true
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM swift:5.5.2

RUN git clone -b 0.2.0 https://github.com/twof/Downstream.git && \
cd Downstream && \
swift build -c release && \
cp -f .build/release/downstream /usr/local/bin/downstream
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/jpsim/Yams.git",
"state": {
"branch": null,
"revision": "9ff1cc9327586db4e0c8f46f064b6a82ec1566fa",
"version": "4.0.6"
"revision": "88caa2e6fffdbef2e91c2022d038576062042907",
"version": "4.0.0"
}
}
]
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ In your `.pre-commit-config.yaml` add the following
```yaml
repos:
- repo: https://github.com/twof/Downstream
rev: 0.1.0
rev: 0.3.0
hooks:
- id: downstream
```

Alternatively, if you would like to use Downstream on a system without Swift installed, you may use
`- id: downstream-docker`. You will need to have Docker installed on that system.

### Github Actions Installation

You can also have Github comment on PRs when file changes may necessitate other changes. Here is an example setup.
Expand Down

0 comments on commit 026568f

Please sign in to comment.