Skip to content

fix: quote version: "2" in golangci-lint config (must be string not n… #38

fix: quote version: "2" in golangci-lint config (must be string not n…

fix: quote version: "2" in golangci-lint config (must be string not n… #38

name: Check Upstream Releases
on:
schedule:
# Run every Monday at 9am UTC
- cron: '0 9 * * 1'
workflow_dispatch:
inputs:
force_check:
description: 'Force check even if version unchanged'
required: false
type: boolean
default: false
permissions:
contents: write
issues: write
jobs:
check-upstream:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check Python Globus SDK releases
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
# Function to check a specific version line
check_version_line() {
local version_line="$1"
local upstream_repo="globus/globus-sdk-python"
local repo_label="Python Globus SDK $version_line"
local version_key="$upstream_repo:$version_line"
echo "Checking $repo_label..."
# Get all releases and filter by version pattern
if [ "$version_line" = "v3" ]; then
version_pattern="^v3\."
else
version_pattern="^v4\."
fi
# Get latest release matching the version pattern
latest_tag=$(gh release list --repo "$upstream_repo" --limit 100 --json tagName 2>/dev/null | \
jq -r ".[].tagName" | grep -E "$version_pattern" | head -n1)
if [ -z "$latest_tag" ]; then
echo " ⚠️ Could not find $version_line release for $upstream_repo"
return 0
fi
# Get full release details
latest_release=$(gh release view --repo "$upstream_repo" "$latest_tag" --json tagName,name,body,url,publishedAt 2>/dev/null || echo "")
if [ -z "$latest_release" ]; then
echo " ⚠️ Could not fetch release details for $latest_tag"
return 0
fi
release_name=$(echo "$latest_release" | jq -r '.name')
release_body=$(echo "$latest_release" | jq -r '.body')
release_url=$(echo "$latest_release" | jq -r '.url')
published_at=$(echo "$latest_release" | jq -r '.publishedAt')
# Get stored version
stored_version=$(jq -r --arg key "$version_key" '.[$key]' .github/upstream-versions.json)
echo " Current tracked: $stored_version"
echo " Latest upstream: $latest_tag"
# Check if version changed or force check
if [ "$stored_version" = "$latest_tag" ] && [ "${{ github.event.inputs.force_check }}" != "true" ]; then
echo " ✓ Already up to date"
return 0
fi
# Check if issue already exists for this version
existing_issue=$(gh issue list --repo ${{ github.repository }} \
--search "\"New $repo_label release: $latest_tag\" in:title" \
--json number --jq '.[0].number' 2>/dev/null || echo "")
if [ -n "$existing_issue" ]; then
echo " ℹ️ Issue already exists: #$existing_issue"
return 0
fi
echo " 🆕 New release found: $latest_tag"
# Build comparison URL
comparison_url="https://github.com/$upstream_repo/compare/$stored_version...$latest_tag"
# Create issue body
issue_body="## New $repo_label Release Available
**New Version:** \`$latest_tag\`

Check failure on line 102 in .github/workflows/check-upstream-releases.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/check-upstream-releases.yml

Invalid workflow file

You have an error in your yaml syntax on line 102
**Previous Version:** \`$stored_version\`
**Published:** $published_at
**Version Line:** $version_line
### Links
- 📦 [Release Page]($release_url)
- 🔍 [Compare Changes]($comparison_url)
- 📚 [Repository](https://github.com/$upstream_repo)
### Release Notes
$release_body
---
### Action Items
- [ ] Review release notes and changes
- [ ] Check for breaking changes or deprecations
- [ ] Port new features and improvements
- [ ] Update tests for new functionality
- [ ] Update documentation if needed
- [ ] Update \`.github/upstream-versions.json\` after porting changes
**Upstream Repository:** \`$upstream_repo\` ($version_line)
"
# Create the issue
issue_number=$(gh issue create \
--title "New $repo_label release: $latest_tag" \
--body "$issue_body" \
--label "upstream-update,needs-review,dependencies,$version_line" \
--json number --jq '.number')
echo " ✓ Created issue #$issue_number"
# Update the version tracking file
jq --arg key "$version_key" --arg version "$latest_tag" \
'.[$key] = $version' .github/upstream-versions.json > .github/upstream-versions.json.tmp
mv .github/upstream-versions.json.tmp .github/upstream-versions.json
# Mark for commit
echo "true" > /tmp/has_update
echo "$version_line=$latest_tag" >> /tmp/updated_versions
}
# Check both v3 and v4 version lines
check_version_line "v3"
check_version_line "v4"
echo "Upstream check complete!"
- name: Commit version updates
run: |
if [ -f /tmp/has_update ]; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Check if there are changes to commit
if git diff --quiet .github/upstream-versions.json; then
echo "No version updates to commit"
exit 0
fi
# Build commit message
commit_msg="chore: update upstream version tracking"$'\n\n'
while IFS= read -r line; do
commit_msg+="- Updated Python SDK $line"$'\n'
done < /tmp/updated_versions
git add .github/upstream-versions.json
git commit -m "$commit_msg"
git push
echo "✓ Committed version update"
else
echo "No updates found"
fi
- name: Summary
if: always()
run: |
echo "## Upstream Release Check Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Tracking:** Python Globus SDK (globus/globus-sdk-python)" >> $GITHUB_STEP_SUMMARY
echo "- v3.x releases" >> $GITHUB_STEP_SUMMARY
echo "- v4.x releases" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -f /tmp/has_update ]; then
echo "### 🆕 New Releases Found" >> $GITHUB_STEP_SUMMARY
while IFS= read -r line; do
echo "- $line" >> $GITHUB_STEP_SUMMARY
done < /tmp/updated_versions
else
echo "✓ Already up to date with upstream" >> $GITHUB_STEP_SUMMARY
fi