Skip to content

Commit 661993e

Browse files
author
anita-steiner
committed
add lint
1 parent 070227c commit 661993e

File tree

9 files changed

+78
-18
lines changed

9 files changed

+78
-18
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "docker" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

.github/linters/.hadolint.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ignored:
2+
- DL3018

.github/workflows/build.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: build
2+
3+
on: [push, workflow_dispatch]
4+
5+
env:
6+
WORKFLOW_BRANCH: "new_deployment"
7+
TIME_ZONE: "Europe/Vienna"
8+
9+
permissions:
10+
id-token: write
11+
contents: read
12+
13+
concurrency:
14+
group: '${{ github.workflow }}-${{ github.ref || github.head_ref }}'
15+
cancel-in-progress: true
16+
17+
jobs:
18+
prepare:
19+
runs-on: ubuntu-22.04
20+
steps:
21+
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v3
23+
with:
24+
repository: datavisyn/github-workflows
25+
ref: ${{ env.WORKFLOW_BRANCH }}
26+
path: ./tmp/github-workflows
27+
- name: lint dockerfiles
28+
id: lint-docker
29+
uses: ./tmp/github-workflows/.github/actions/lint-docker
30+
with:
31+
config: .github/linters/.hadolint.yaml
32+
recursive: true
33+
- name: show dockerfile lint error
34+
if: ( steps.lint-docker.outcome == 'failure' )
35+
run: |
36+
echo ${{ steps.lint-docker.outcome }}
37+
echo -e "#### Docker Lint Result: ${{ steps.lint-docker.outputs.results }}"
38+
- name: lint github action files
39+
id: lint-ga
40+
uses: ./tmp/github-workflows/.github/actions/lint-github-actions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.log

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# Trigger Workflow and Wait
22

33
Github Action for trigger a workflow from another workflow. The action then waits for a response.
4-
see: https://github.com/datavisyn/github-action-trigger-workflow/blob/master/README.md
4+
see: <https://github.com/datavisyn/github-action-trigger-workflow/blob/master/README.md>
55

6-
see also https://github.com/convictional/github-action-trigger-workflow
6+
see also <https://github.com/convictional/github-action-trigger-workflow>
77

88
**When would you use it?**
99

1010
When deploying an app you may need to deploy additional services, this Github Action helps with that.
1111

12-
1312
## Arguments
1413

1514
| Argument Name | Required | Default | Description |
@@ -26,7 +25,6 @@ When deploying an app you may need to deploy additional services, this Github Ac
2625
| `trigger_workflow` | False | `true` | Trigger the specified workflow. |
2726
| `wait_workflow` | False | `true` | Wait for workflow to finish. |
2827

29-
3028
## Example
3129

3230
### Simple
@@ -57,7 +55,6 @@ When deploying an app you may need to deploy additional services, this Github Ac
5755
wait_workflow: true
5856
```
5957
60-
6158
## Testing
6259
6360
You can test out the action locally by cloning the repository to your computer. You can run:
@@ -107,4 +104,3 @@ For testing a failure case, just add this line after the sleep:
107104
## Potential Issues
108105
109106
### Changes
110-

action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
name: 'Trigger Workflow'
2-
description: 'Triggers another workflows and wait'
1+
name: github-action-trigger-workflow
2+
description: Triggers another workflows and wait
3+
author: datavisyn
4+
35
inputs:
46
owner:
57
description: "The owner of the repository where the workflow is contained."

entrypoint.sh

100644100755
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ validate_args() {
8484

8585
lets_wait() {
8686
echo "Sleeping for ${wait_interval} seconds"
87-
sleep $wait_interval
87+
sleep "$wait_interval"
8888
}
8989

9090
api() {
@@ -105,12 +105,6 @@ api() {
105105
fi
106106
}
107107

108-
lets_wait() {
109-
local interval=${1:-$wait_interval}
110-
echo >&2 "Sleeping for $interval seconds"
111-
sleep "$interval"
112-
}
113-
114108
# Return the ids of the most recent workflow runs, optionally filtered by user
115109
get_workflow_runs() {
116110
since=${1:?}
@@ -209,8 +203,8 @@ main() {
209203
echo "Skipping waiting for workflow."
210204
fi
211205
}
212-
echo ${GITHUB_API_URL}
213-
echo ${INPUT_OWNER}
214-
echo ${INPUT_REPO}
206+
echo "${GITHUB_API_URL}"
207+
echo "${INPUT_OWNER}"
208+
echo "${INPUT_REPO}"
215209

216210
main

lint-locally.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -o errexit
3+
set -o pipefail
4+
set -o nounset
5+
6+
# actionlint
7+
#docker run --rm -v $(pwd):/repo --workdir /repo rhysd/actionlint:latest -color
8+
9+
# https://github.com/github/super-linter
10+
docker pull github/super-linter:slim-v4
11+
docker run -e RUN_LOCAL=true -e USE_FIND_ALGORITHM=true -e VALIDATE_ALL_CODEBASE=true --env-file "./super-linter-locally.env" -v "$PWD":/tmp/lint github/super-linter:slim-v4

super-linter-locally.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
VALIDATE_ALL_CODEBASE=true
2+
VALIDATE_NATURAL_LANGUAGE=false
3+

0 commit comments

Comments
 (0)