feat(providers): add Liquid AI (LFM2) as OpenAI-compatible provider #578
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 Hygiene | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| permissions: | |
| pull-requests: write | |
| jobs: | |
| check-shared-commits: | |
| name: Check branch hygiene | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Detect shared commits with other open PRs | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} | |
| REPO: ${{ github.repository }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| # Get this PR's commit SHAs (sorted for comm) | |
| gh api "repos/${REPO}/pulls/${PR_NUMBER}/commits?per_page=100" \ | |
| --jq '.[].sha' | sort > /tmp/this_commits.txt | |
| if [ ! -s /tmp/this_commits.txt ]; then | |
| echo "No commits in PR." | |
| exit 0 | |
| fi | |
| this_count=$(wc -l < /tmp/this_commits.txt | tr -d ' ') | |
| echo "This PR has ${this_count} commit(s)." | |
| # Get other open PR numbers | |
| gh api "repos/${REPO}/pulls?state=open&per_page=100" \ | |
| --jq ".[] | select(.number != ${PR_NUMBER}) | .number" > /tmp/other_prs.txt | |
| if [ ! -s /tmp/other_prs.txt ]; then | |
| echo "No other open PRs to compare." | |
| exit 0 | |
| fi | |
| # Check each other PR for shared commits | |
| contaminated="" | |
| while read -r other_pr; do | |
| gh api "repos/${REPO}/pulls/${other_pr}/commits?per_page=100" \ | |
| --jq '.[].sha' | sort > /tmp/other_commits.txt | |
| shared=$(comm -12 /tmp/this_commits.txt /tmp/other_commits.txt || true) | |
| shared_count=$(echo "${shared}" | grep -c . || true) | |
| if [ "${shared_count}" -gt 0 ]; then | |
| other_title=$(gh api "repos/${REPO}/pulls/${other_pr}" --jq '.title') | |
| contaminated="${contaminated}- #${other_pr} (\`${other_title}\`): ${shared_count} shared commit(s)"$'\n' | |
| fi | |
| done < /tmp/other_prs.txt | |
| if [ -z "${contaminated}" ]; then | |
| echo "Clean — no shared commits with other PRs." | |
| exit 0 | |
| fi | |
| echo "Shared commits detected with other open PRs." | |
| # Don't post duplicate comments | |
| already=$(gh api "repos/${REPO}/issues/${PR_NUMBER}/comments?per_page=100" \ | |
| --jq '[.[] | select(.user.login == "github-actions[bot]" and (.body | contains("Branch hygiene")))] | length') | |
| if [ "${already}" -gt 0 ]; then | |
| echo "Already commented, skipping." | |
| exit 0 | |
| fi | |
| # Build comment body | |
| { | |
| echo "### Branch hygiene" | |
| echo "" | |
| echo "This PR shares commits with other open PRs:" | |
| echo "" | |
| echo "${contaminated}" | |
| echo "This usually means the branch was created from your fork's \`main\` instead of \`upstream/main\`. Each PR should only contain its own commits." | |
| echo "" | |
| echo "**To fix**, rebase onto upstream/main:" | |
| echo "" | |
| echo "\`\`\`bash" | |
| echo "git fetch upstream" | |
| echo "git rebase --onto upstream/main \$(git merge-base HEAD upstream/main) ${PR_HEAD_REF}" | |
| echo "git push --force-with-lease origin ${PR_HEAD_REF}" | |
| echo "\`\`\`" | |
| echo "" | |
| echo "See [CONTRIBUTING.md](https://github.com/${REPO}/blob/main/CONTRIBUTING.md#branching-important-for-forks) for details." | |
| } > /tmp/comment.md | |
| gh pr comment "${PR_NUMBER}" --body-file /tmp/comment.md |