Skip to content
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
41 changes: 39 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarqube:
name: SonarQube
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -18,3 +18,40 @@ jobs:
uses: SonarSource/sonarqube-scan-action@v6
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to GitHub Docker Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Git commit SHA
id: get_sha
run: echo "GIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
tags: |
ghcr.io/${{ github.repository }}/eapp:${{ github.event.inputs.environment }}-${{ github.run_number }}-${{ env.GIT_SHA }}
outputs: type=docker,dest=/tmp/eapp.tar

- name: Push Docker image
if: success()
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}/eapp:${{ github.event.inputs.environment }}-${{ github.run_number }}-${{ env.GIT_SHA }}

- name: Log out from Docker Registry
if: always()
run: docker logout ghcr.io
16 changes: 13 additions & 3 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,29 @@ on:
jobs:
pull-request-check:
runs-on: ubuntu-latest

steps:

# Checkout the repository code
- name: Code checkout
id: code_checkout
uses: actions/checkout@v4

# Check PR title prefix to ensure it follows the convention
- name: Check PR title prefix
run: |
echo "PR Title: '${{ github.event.pull_request.title }}'"

if [[ ! "${{ github.event.pull_request.title }}" =~ ^(ci|feat|fix|chore|docs|refactor): ]]; then
echo "❌ PR title must start with one of: ci:, feat:, fix:, chore:, docs:, refactor:"
exit 1
else
echo "✅ PR title is valid."
fi

# Scan the repo for any sensitive information like secrets etc
- name: Secret Scanning
uses: trufflesecurity/trufflehog@main
with:
path: ./ # Code repository path
base: "" # Start scanning from here
head: ${{ github.head_ref || github.ref_name }} # Scan commits until here
head: ${{ github.head_ref || github.ref_name }} # Scan commits until here
extra_args: --only-verified
Loading