Skip to content

Commit

Permalink
your new commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
DevX Updater committed Feb 9, 2024
0 parents commit ad2f4a5
Show file tree
Hide file tree
Showing 21 changed files with 1,463 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>apentsak-vitech/renovate-config"]
}






100 changes: 100 additions & 0 deletions .github/workflows/detect-changed-actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Detect Changed Action

on:
push:
branches:
- main

concurrency:
group: ${{ github.repository }}
cancel-in-progress: false

permissions:
pull-requests: write
contents: write
id-token: write
checks: write
actions: write
security-events: write

jobs:
version-bump:
runs-on: ubuntu-latest
environment: test
outputs:
previousVersionTag: ${{ steps.tag_version.outputs.previous_tag }}
newVersionTag: ${{ steps.tag_version.outputs.new_tag }}
changelog: ${{ steps.tag_version.outputs.changelog }}
steps:
- uses: actions/checkout@v4
- name: Calculate Versions and Tags
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.PAT_TOKEN }}
dry_run: true

detect-changed-action:
name: Detect Changed Actions
runs-on: ubuntu-latest
needs: version-bump
environment: test
outputs:
createRelease: ${{ steps.detect.outputs.release }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
- name: ⇣ Search for changed actions
shell: bash
id: detect
env:
GH_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
git fetch origin
git checkout -B main origin/main
git pull --unshallow
git config --global user.email "[email protected]"
git config --global user.name "DevX Updater"
latest_tag=${{ needs.version-bump.outputs.previousVersionTag }}
new_tag=${{ needs.version-bump.outputs.newVersionTag }}
echo "git diff --name-only $latest_tag..HEAD"
files=`git diff --name-only $latest_tag..HEAD --oneline|sort|uniq`
printf "[*] Updated Files:\n$files\n"
echo "[*] Files to update"
for file in $files; do
action_name=`dirname $file`
if [[ $action_name == "." ]];then continue; fi
grep -rl "$action_name@" . | grep -v '.git' || continue
update_files=`grep -rl "$action_name@" . | grep -v '.git'`
echo $update_files | xargs sed -i "s|$action_name@.*|$action_name@$new_tag|g" || echo "No files were found"
echo $update_files | xargs git add
done
git commit -m "fix: update versions to $new_tag" && \
git push origin -u main && echo "release=true" >> $GITHUB_OUTPUT && echo "release=true" || \
( echo "!!! No actions were updated !!!" && echo "release=false" >> $GITHUB_OUTPUT && echo "release=false" )
create-release:
name: Create GH Release
environment: test
needs:
- detect-changed-action
- version-bump
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Bump Version and Push Tags
if: ${{ needs.detect-changed-action.outputs.createRelease == 'true' }}
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.PAT_TOKEN }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
if: ${{ needs.detect-changed-action.outputs.createRelease == 'true' }}
with:
tag: ${{ needs.version-bump.outputs.newVersionTag }}
name: Release ${{ needs.version-bump.outputs.newVersionTag }}
body: ${{ needs.version-bump.outputs.changelog }}
39 changes: 39 additions & 0 deletions .github/workflows/terragrunt-project-pet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Terragrunt PET

#on: pull_request
on:
push:
branches:
- asdasdasdasd
permissions:
pull-requests: write
contents: write
id-token: write
checks: write
actions: write
security-events: write

env:
GITHUB_TOKEN: ${{ secrets.GHUB_TOKEN }}

jobs:

define-targets:
name: Test Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Terragrunt HCL Log
uses: apentsak-vitech/gh-checks/github/publish-checks@main
with:
name: Terragrunt HCL Log
conclusion: success
description-file: terraform1.md

- name: Terragrunt HCL Log
uses: apentsak-vitech/gh-checks/github/publish-checks@main
with:
name: Terragrunt HCL Log
conclusion: success
description-file: terraform2.txt
51 changes: 51 additions & 0 deletions .github/workflows/test-trigg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Detect Changed Action

on:
push:
branches:
- dev

permissions:
pull-requests: write
contents: write
id-token: write
checks: write
actions: write
security-events: write

jobs:
detect-changed-action:
name: Detect Changed Actions
runs-on: ubuntu-latest
environment: test
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
- name: ⇣ Search for changed actions
shell: bash
id: config
env:
GH_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
if ! [[ -z "${{ env.GH_TOKEN }}" ]]; then
echo GH_TOKEN=true
else
echo GH_TOKEN=false
fi
if ! [[ -z "${{ secrets.PAT_TOKEN }}" ]]; then
echo secretsPAT_TOKEN=true
else
echo secretsPAT_TOKEN=false
fi
# git fetch origin
# git checkout -B main origin/main
# git pull --unshallow
# git config --global user.email "[email protected]"
# git config --global user.name "DevX Updater"
# echo TEST > `date '+%N'`.txt
# git add .
# git commit -m "fix: TEST!!!" &&
# git push origin -u main || echo !!! No files were updated !!!

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.iml
.idea/
7 changes: 7 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# About CODEOWNERS file:
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#example-of-a-codeowners-file

# This file holds Code Owners for the main branch.
# Mentioned members or teams will be automatically added as reviewers for PR to the target branch

* @apentsak-vitech
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# gh-checks

asdasd
86 changes: 86 additions & 0 deletions docker/build_v2/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: 'Docker Build'
description: 'Build provided dockerfiles'
inputs:

devx-config:
description: Images descriptor
default: .devx.yaml
image-tag:
description: Docker image version
required: true
imageSuffix:
description: Docker Image Suffix
required: true
registry-base-url:
description: Docker registry base URL
required: true

NEXUS_USERNAME:
description: Nexus username
required: true
NEXUS_PASSWORD:
description: Nexus password
required: true
AWS_ACCESS_KEY_ID:
description: AWS Access key
required: false
AWS_SECRET_ACCESS_KEY:
description: AWS secret key
required: false

outputs:
images:
description: comma-separated list of images
value: ${{ steps.images-build.outputs.images }}

runs:
using: 'composite'
steps:
- name: ⇣ Get Dockerfile configs
shell: bash
id: config
run: |
eval `yq eval '.image-builder.images' -p yaml -o json < ${{ inputs.devx-config }} | jq -r --arg job_name "${{ inputs.imageSuffix }}" 'map(select(.imageSuffix | contains($job_name))) | .[0]| @sh "imageSuffix=\(.imageSuffix) dockerfile=\(.dockerfile) build_args=\(."build-args") docker_build_context_folder=\(."docker-build-context-folder")"'`
echo "imageSuffix=${imageSuffix}" >> $GITHUB_OUTPUT
echo "dockerfile=${dockerfile}" >> $GITHUB_OUTPUT
echo "build_args=${build_args}" >> $GITHUB_OUTPUT
echo "docker_build_context_folder=${docker_build_context_folder}" >> $GITHUB_OUTPUT
echo $GITHUB_OUTPUT
- name: Build Images
id: images-build
shell: bash
env:
DEVX_CONFIG: ${{ inputs.devx-config }}
TAG: ${{ inputs.image-tag }}
REPO_NAME: ${{ github.event.repository.name }}
REGISTRY_BASE_URL: ${{ inputs.registry-base-url }}
run: |
set -x
result=()
imageSuffix="${{ steps.config.outputs.imageSuffix }}"
if [[ "$imageSuffix" != "" ]]; then
imageSuffix="/$imageSuffix"
else
imageSuffix=""
fi
export IMAGE="$REGISTRY_BASE_URL/$REPO_NAME$imageSuffix:$TAG"
echo "::group::📦 Building $IMAGE"
dockerfile="${{ steps.config.outputs.dockerfile }}"
buildArgs="${{ steps.config.outputs.build_args }}"
dockerBuildContextFolder="${{ steps.config.outputs.docker_build_context_folder }}"
docker build $(echo "$buildArgs") -t "$IMAGE" -f "$dockerfile" "$dockerBuildContextFolder"
result+=("$IMAGE")
echo "::endgroup::"
echo "images=$(IFS=,; echo "${result[*]}")" >> $GITHUB_OUTPUT
23 changes: 23 additions & 0 deletions docker/find-images/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Find Images
description: |
inputs:
keyword:
description: Keyword to find the images

outputs:
images:
description: comma-separated list of images
value: ${{ steps.collect-images.outputs.images }}

runs:
using: 'composite'
steps:
- id: collect-images
shell: bash
run: |
set -x
IMAGES=$(docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "${{ inputs.keyword }}" | cat | tr '\n' ',' | sed 's/,$//')
echo $IMAGES
echo "images=$IMAGES" >> $GITHUB_OUTPUT
48 changes: 48 additions & 0 deletions github/publish-checks/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Checks Action
description: |
inputs:
name:
description: Check name
required: true
conclusion:
description: Check conclusion
required: true
description-file:
description: Path to file with detailed check description
required: true

runs:
using: 'composite'
steps:
- uses: actions/github-script@v6
if: always()
with:
script: |
const fs = require('fs');
const timestamp = new Date().toISOString();
const summary = '${{ inputs.conclusion }}' === 'success'
? 'No violations found'
: 'Please check the report below for more details';
const description = fs.readFileSync('${{ inputs.description-file }}', {encoding:'utf8', flag:'r'});
await github.rest.checks.create({
name: '${{ inputs.name }}',
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
head_sha: context.payload.pull_request ? context.payload.pull_request.head.sha : context.sha,
status: 'completed',
started_at: timestamp,
completed_at: timestamp,
conclusion: '${{ inputs.conclusion }}',
output: {
title: '${{ inputs.name }}',
summary: summary,
text: description,
}
});
Loading

0 comments on commit ad2f4a5

Please sign in to comment.