-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: clone sanitychecks from plugin repository
- Loading branch information
1 parent
f460fd9
commit 1d770a2
Showing
3 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Gather Sanity Checks | ||
|
||
on: | ||
push: | ||
branches: | ||
- feat/clone | ||
workflow_dispatch: {} | ||
schedule: | ||
- cron: "0 20 * * *" | ||
|
||
jobs: | ||
gather: | ||
name: Gather Sanity Checks | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
|
||
- name: Get all sanity check from remote repository | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
DESTINATION_PATH=src/test/resources/sanity-checks/ | ||
REPOSITORIES=$(gh repo list kestra-io -L 1000 --json name | jq -r .[].name | sort | grep "^plugin-") | ||
mkdir -p /tmp/repositories /tmp/results | ||
cd /tmp/repositories | ||
for REPOSITORY in $REPOSITORIES | ||
do | ||
git clone --filter=blob:none --sparse https://$GH_TOKEN:@github.com/kestra-io/$REPOSITORY.git | ||
cd $REPOSITORY | ||
git sparse-checkout init --cone | ||
git sparse-checkout add $DESTINATION_PATH | ||
if test -d $DESTINATION_PATH; then | ||
COUNT=$(find $DESTINATION_PATH -type f | wc -l) | ||
else | ||
COUNT=0 | ||
fi | ||
if [ "$COUNT" -gt "0" ]; then | ||
mkdir -p ../../results/$REPOSITORY | ||
cp -R $DESTINATION_PATH* ../../results/$REPOSITORY | ||
echo -e "\x1B[32m-> $REPOSITORY - $COUNT found \x1B[0m" | ||
else | ||
echo -e "\x1B[31m-> $REPOSITORY - No sanity check found \x1B[0m" | ||
fi | ||
cd .. | ||
rm -rf $REPOSITORY | ||
done | ||
rm -rf plugin-* | ||
- name: Prepare the commit | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
mkdir -p sanitychecks/plugins | ||
rm -rf sanitychecks/plugins | ||
cp -R /tmp/results/ sanitychecks/plugins | ||
git add * | ||
- name: Check for changes and commit | ||
run: | | ||
if git diff --cached --quiet; then | ||
echo -e "\x1B[32m-> No changes to commit. Exiting with success. \x1B[0m" | ||
exit 0 | ||
fi | ||
git config user.name "github-actions[bot]" | ||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git commit -m "chore: add sanity check from plugin repository" | ||
git push origin main | ||
echo -e "\x1B[32m-> Pushing to main. \x1B[0m" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,21 @@ | ||
# Common | ||
**/.env | ||
Thumbs.db | ||
.DS_Store | ||
.gradle | ||
build/ | ||
target/ | ||
out/ | ||
.idea | ||
.vscode | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.project | ||
.settings | ||
.classpath | ||
.attach* | ||
|
||
# Custom | ||
.wip | ||
*.py |
Empty file.