Skip to content

Commit

Permalink
Merge pull request #130 from jerensl/fix/single-file-with-no-newline
Browse files Browse the repository at this point in the history
fix: fix single file with no newline will fail the action
  • Loading branch information
jerensl authored Nov 4, 2024
2 parents 8623df8 + 61fc3ae commit f280cbc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
25 changes: 16 additions & 9 deletions manifest-merger.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
touch __intermediate_file.yml
echo $FILE_PATH

append_with_newline() {
file=$1
cat "$file" >> __intermediate_file.yml
if [ -n "$(tail -c 1 "$file")" ]; then
echo "" >> __intermediate_file.yml
fi
echo "---" >> __intermediate_file.yml
}

if [[ -d $FILE_PATH ]]; then
for file in $FILE_PATH/*; do # FILE_PATH is the environment variable
echo $file
if [[ $file == *yaml ]] || [[ $file == *yml ]]
then
cat $file >> __intermediate_file.yml
echo "---" >> __intermediate_file.yml
for file in "$FILE_PATH"/*; do
if [[ $file == *.yaml || $file == *.yml ]]; then
append_with_newline "$file"
fi
done;
done
else
cat $FILE_PATH >> __intermediate_file.yml
fi
append_with_newline "$FILE_PATH"
fi
6 changes: 3 additions & 3 deletions workflow-templates/file-uploadTemplate.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Kanvas Screenshot Service
'on':
pull_request_target:
on:
pull_request:
types:
- opened
- synchronize
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
path: action
repository: layer5labs/kanvas-snapshot
- id: test_result
uses: layer5labs/[email protected].15
uses: layer5labs/[email protected].16
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
mesheryToken: ${{ secrets.MESHERY_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions workflow-templates/url-uploadTemplate.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Kanvas Snapshot With URL-Upload
'on':
pull_request_target:
on:
pull_request:
types:
- opened
- synchronize
Expand Down Expand Up @@ -30,7 +30,7 @@ jobs:
path: action
repository: layer5labs/kanvas-snapshot
- id: test_result
uses: layer5labs/[email protected].15
uses: layer5labs/[email protected].16
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
mesheryToken: ${{ secrets.MESHERY_TOKEN }}
Expand Down

0 comments on commit f280cbc

Please sign in to comment.