Skip to content

Commit

Permalink
workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanminutillo committed Jan 8, 2025
1 parent 4abfb16 commit d10eeb8
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/watch-repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,31 @@ jobs:
- name: Load Configuration
id: config
run: |
# Get config directly from osiris-server instead of local file
OSIRIS_URL="https://osiris-server.vercel.app"
CONFIG=$(curl -s "$OSIRIS_URL/watcher/config/repositories.yml")
# Install yq if not present
sudo wget https://github.com/mikefarah/yq/releases/download/v4.40.5/yq_linux_amd64 -O /usr/local/bin/yq
sudo chmod +x /usr/local/bin/yq
# Get config from API endpoint
CONFIG=$(curl -s "$OSIRIS_URL/api/config")

if [ -z "$CONFIG" ]; then
echo "::error::Failed to fetch configuration from osiris-server"
exit 1
fi

# Parse the downloaded config
# Parse the YAML into JSON for the repository
REPO_CONFIG=$(echo "$CONFIG" | yq -o=json ".repositories[\"${{ github.repository }}\"]")

if [ "$REPO_CONFIG" == "null" ]; then
echo "Repository ${{ github.repository }} not configured for watching"
exit 0
fi

# Export config using GitHub Actions environment file syntax
# Log for debugging
echo "Repository config:"
echo "$REPO_CONFIG" | jq '.'

# Export config
echo 'CONFIG<<EOF' >> $GITHUB_ENV
echo "$REPO_CONFIG" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
Expand Down

0 comments on commit d10eeb8

Please sign in to comment.