Make the AssemblyLoadContexts not collectable (#42) #45
This file contains hidden or 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
| name: PR Version Preview | |
| on: | |
| pull_request: | |
| # Re-run the version calculation when labels are added or when new commits are pushed | |
| types: [opened, synchronize, labeled, reopened, edited] | |
| branches: [main] | |
| permissions: | |
| pull-requests: write | |
| contents: read | |
| jobs: | |
| preview: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout full history and all tags | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| # Get latest tag and calculate next version | |
| - name: Get latest tag and bump type | |
| id: version | |
| run: | | |
| # Be defensive and robust: use awk to split version numbers and always quote $GITHUB_OUTPUT | |
| git fetch --tags || true | |
| current=$(git describe --tags --abbrev=0 2>/dev/null || true) | |
| if [ -z "$current" ]; then | |
| echo "No tags found, defaulting to v0.0.0" | |
| current="v0.0.0" | |
| fi | |
| # Remove leading 'v' then extract parts using awk | |
| ver=${current#v} | |
| major=$(printf "%s" "$ver" | awk -F. '{print $1+0}') | |
| minor=$(printf "%s" "$ver" | awk -F. '{print $2+0}') | |
| patch=$(printf "%s" "$ver" | awk -F. '{print $3+0}') | |
| # Determine bump type from PR labels (safe interpolation) | |
| LABELS="${{ join(github.event.pull_request.labels.*.name, ' ') }}" | |
| if printf "%s" "$LABELS" | grep -q "major"; then | |
| major=$((major+1)); minor=0; patch=0; type="major" | |
| elif printf "%s" "$LABELS" | grep -q "minor"; then | |
| minor=$((minor+1)); patch=0; type="minor" | |
| else | |
| patch=$((patch+1)); type="patch" | |
| fi | |
| next="v${major}.${minor}.${patch}" | |
| # Safely write outputs | |
| if [ -n "$GITHUB_OUTPUT" ]; then | |
| # Write all outputs in one redirect to avoid multiple open/close | |
| { | |
| printf '%s\n' "current=$current" "next=$next" "type=$type" | |
| } >> "$GITHUB_OUTPUT" | |
| else | |
| # Fallback to printing if GITHUB_OUTPUT not available (for local debugging) | |
| echo "current=$current" | |
| echo "next=$next" | |
| echo "type=$type" | |
| fi | |
| - name: Comment version preview | |
| uses: peter-evans/create-or-update-comment@v4 | |
| with: | |
| issue-number: ${{ github.event.pull_request.number }} | |
| body: | | |
| **Next version:** **${{ steps.version.outputs.next }}** |