Skip to content

Commit

Permalink
Update alert.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
pho-phoenix authored Aug 20, 2024
1 parent 00fdc1b commit 424adf7
Showing 1 changed file with 50 additions and 16 deletions.
66 changes: 50 additions & 16 deletions .github/workflows/alert.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,53 @@
name: Alert

on:
push:
branches: [ master ]

name: test-adapter
on: [pull_request]
jobs:
deploy:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Update unlisted
run: |
curl --fail https://born-to-llama.herokuapp.com/refresh
exit $?
- name: Deploy to server
run: |
curl --fail https://born-to-llama.herokuapp.com/rebuild-server
exit $?
- id: file_changes
uses: trilom/[email protected]
with:
output: 'json'
fileOutput: 'json'
- name: Check out repository code
uses: actions/checkout@v2
- name: Run changes files through test script
run: |
# Store the current commit hash in a variable
current_commit=$(git rev-parse HEAD)
# Checkout to master to check if new adapters files are of v2
git fetch origin master:master
# Checkout back to the original commit
git checkout $current_commit
RUN_FILES=$(
MODIFIED=${{ steps.file_changes.outputs.files_modified}} \
ADDED=${{ steps.file_changes.outputs.files_added}} \
node ${{ github.workspace }}/.github/workflows/getFileList.js
)
if [ "$RUN_FILES" = "[]" ]; then
echo "No adapter files were modified"
exit 0
fi
npm ci
list=$(echo $RUN_FILES | tr -d '"[]' | tr "," "\n")
for i in ${list}
do
{
IFS='@' read -r -a array <<< "$i"
npm run test ${array[0]} ${array[1]} 2>&1 | tee output.txt
node ${{ github.workspace }}/.github/workflows/commentResult.js /home/runner/work/dimension-adapters/dimension-adapters/output.txt "${{ github.repository_owner }}" "${{ github.event.repository.name }}" "${{ github.event.number }}" ${i}
if grep -q "\-\-\-\- ERROR \-\-\-\-" output.txt; then
exit 1;
fi
} || {
echo -n $i
echo ' doesnt run'
}
done

0 comments on commit 424adf7

Please sign in to comment.