Skip to content

Commit

Permalink
Merge branch 'main' into pr-post-lab-link
Browse files Browse the repository at this point in the history
  • Loading branch information
neoformit committed Nov 12, 2024
2 parents 37c3032 + 75c71e3 commit 3be4330
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/link_labs.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Post link to lab
name: Check Lab HTTP status

on:
pull_request:
types: [opened, reopened]
types: [opened]

jobs:
post-comment:
Expand All @@ -21,7 +21,6 @@ jobs:
cat changed_files.txt
- name: Post comment if matching changes found
# if: contains(steps.changed-files.outputs.changes, 'communities/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -41,16 +40,30 @@ jobs:
cat <<EOF > comment.md
### Preview changes to ${NAME} Lab
https://labs.usegalaxy.org.au/?content_root=https://github.com/${USERNAME}/galaxy_codex/blob/${BRANCH_NAME}/communities/${NAME}/lab/base.yml
https://labs.usegalaxy.org.au/?content_root=https://github.com/${USERNAME}/galaxy_codex/blob/${BRANCH_NAME}/communities/${NAME}/lab/base.yml&cache=false
- [usegalaxy.org.yml](https://labs.usegalaxy.org.au/?content_root=https://github.com/${USERNAME}/galaxy_codex/blob/${BRANCH_NAME}/communities/${NAME}/lab/usegalaxy.org.yml)
- [usegalaxy.eu.yml](https://labs.usegalaxy.org.au/?content_root=https://github.com/${USERNAME}/galaxy_codex/blob/${BRANCH_NAME}/communities/${NAME}/lab/usegalaxy.eu.yml)
- [usegalaxy.org.au.yml](https://labs.usegalaxy.org.au/?content_root=https://github.com/${USERNAME}/galaxy_codex/blob/${BRANCH_NAME}/communities/${NAME}/lab/usegalaxy.org.au.yml)
- [usegalaxy.org.yml](https://labs.usegalaxy.org.au/?content_root=https://github.com/${USERNAME}/galaxy_codex/blob/${BRANCH_NAME}/communities/${NAME}/lab/usegalaxy.org.yml&cache=false)
- [usegalaxy.eu.yml](https://labs.usegalaxy.org.au/?content_root=https://github.com/${USERNAME}/galaxy_codex/blob/${BRANCH_NAME}/communities/${NAME}/lab/usegalaxy.eu.yml&cache=false)
- [usegalaxy.org.au.yml](https://labs.usegalaxy.org.au/?content_root=https://github.com/${USERNAME}/galaxy_codex/blob/${BRANCH_NAME}/communities/${NAME}/lab/usegalaxy.org.au.yml&cache=false)
EOF
gh pr comment "$PR_NUMBER" --body "$(cat comment.md)"
# Write url to file
echo "https://labs.usegalaxy.org.au/?content_root=https://github.com/${USERNAME}/galaxy_codex/blob/${BRANCH_NAME}/communities/${NAME}/lab/base.yml&cache=false" >> "urls.txt"
fi
else
echo "Ignoring changes to $FILE: not in a lab directory"
fi
done
- name: Check URLs for Success Status Code
run: |
while IFS= read -r url; do
status_code=$(curl -o /dev/null -s -w "%{http_code}" "$url")
if [[ "$status_code" -ge 200 && "$status_code" -lt 300 ]]; then
echo "✅ $url returned a success status code: $status_code"
else
echo "❌ $url returned a failure status code: $status_code"
exit 1
fi
done < urls.txt

0 comments on commit 3be4330

Please sign in to comment.