Skip to content

Commit b33121a

Browse files
author
lexander023
committed
more checks
1 parent 1634c39 commit b33121a

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
build-and-push-image:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v3
14+
15+
- name: Log in to the Container registry
16+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
17+
with:
18+
registry: https://ghcr.io
19+
username: ${{ github.actor }}
20+
password: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Build and push Docker image
23+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
24+
with:
25+
context: .
26+
push: true
27+
tags: ghcr.io/AleksanderWWW/prometheus-gitlabci-exporter:"${GITHUB_REF#refs/tags/}"
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: static-checks
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
lint-dockerfile:
12+
needs: [ pre-commit ]
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2
17+
18+
- name: Lint Dockerfile (hadolint)
19+
run: |
20+
docker run --rm -i ghcr.io/hadolint/hadolint:v2.12.1-beta-debian < Dockerfile
21+
working-directory: backend
22+
23+
run-actionlint:
24+
needs: [ pre-commit ]
25+
runs-on: ubuntu-latest
26+
permissions:
27+
# needed for the checkout action
28+
contents: read
29+
# needed to annotate the files in a pull request with comments
30+
pull-requests: write
31+
steps:
32+
- uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2
33+
34+
- uses: devops-actions/actionlint@c6744a34774e4e1c1df0ff66bdb07ec7ee480ca0
35+
36+
check-pr-title:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Check PR title
40+
env:
41+
PR_TITLE: ${{ github.event.pull_request.title }}
42+
run: |
43+
echo "Checking PR title: $PR_TITLE"
44+
45+
# Define the regex for Conventional Commits
46+
CONVENTIONAL_REGEX="^(feat|fix|chore|docs|style|refactor|perf|test|ci|build|revert|security)(\([^)]+\))?!?: .+$"
47+
48+
if [[ ! "$PR_TITLE" =~ $CONVENTIONAL_REGEX ]]; then
49+
echo "❌ PR title does not follow Conventional Commits format!"
50+
echo "📝 Expected format: 'type(scope): description'"
51+
echo "👉 Example: 'feat(auth): add login API'"
52+
exit 1
53+
fi
54+
55+
echo "✅ PR title is valid!"

0 commit comments

Comments
 (0)