add makefile for test and fix blank spaces #58
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2023 Chainguard, Inc. | |
# SPDX-License-Identifier: Apache-2.0 | |
name: Test | |
on: | |
pull_request: | |
branches: | |
- 'main' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Run Digestabot | |
uses: ./ | |
with: | |
create-pr: false | |
- name: Check changes | |
run: | | |
if [[ $(git diff --stat) == '' ]]; then | |
echo 'should exist changes' | |
exit 1 | |
else | |
exit 0 | |
fi | |
shell: bash | |
- name: Check for makefile change with blank spaces/tabs | |
shell: bash | |
run: | | |
file_to_check='testfiles/Makefile' | |
modified_files=$(git diff --name-only && git diff --cached --name-only) | |
# Remove any duplicate entries from the list of modified files | |
modified_files=$(echo "$modified_files" | sort | uniq) | |
# Check if only the specified file is in the list of modified files | |
if [ "$modified_files" == "$file_to_check" ]; then | |
echo "Only $file_to_check has been modified" | |
exit 0 | |
else | |
echo "Other files have been modified or there are no changes" | |
exit 1 | |
fi | |
test-working-dir: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Run Digestabot | |
uses: ./ | |
with: | |
create-pr: false | |
working-dir: './testfiles/test-dir' | |
- name: Check changes | |
shell: bash | |
run: | | |
file_to_check='testfiles/test-dir/k8s-job-2.yaml' | |
modified_files=$(git diff --name-only && git diff --cached --name-only) | |
# Remove any duplicate entries from the list of modified files | |
modified_files=$(echo "$modified_files" | sort | uniq) | |
# Check if only the specified file is in the list of modified files | |
if [ "$modified_files" == "$file_to_check" ]; then | |
echo "Only $file_to_check has been modified" | |
exit 0 | |
else | |
echo "Other files have been modified or there are no changes" | |
exit 1 | |
fi |