Auto-populate scope["user"] with BfabricUser in BfabricAuthMiddleware #1679
Workflow file for this run
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 Checks | |
| on: | |
| push: | |
| branches: [main, stable, release_*] | |
| pull_request: | |
| branches: [main, stable, release_*] | |
| workflow_dispatch: | |
| jobs: | |
| unit_tests: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: | | |
| 3.11 | |
| 3.13 | |
| - name: Install nox | |
| run: pip install nox uv | |
| - name: Run checks | |
| run: nox --report nox-report.json | |
| - name: Summarize nox results | |
| if: always() | |
| run: | | |
| if [ ! -f nox-report.json ]; then exit 0; fi | |
| python3 << 'EOF' | |
| import json, os | |
| with open("nox-report.json") as f: | |
| data = json.load(f) | |
| lines = ["## Nox Session Results\n"] | |
| for s in data["sessions"]: | |
| result = s.get("result", "unknown") | |
| name = s["signatures"][0] | |
| if result == "success": | |
| icon = "✅" | |
| elif result in ("skipped", "skip"): | |
| icon = "⏭️" | |
| else: | |
| icon = "❌" | |
| print(f"::error::Nox session failed: {name}") | |
| lines.append(f"{icon} `{name}`: {result}") | |
| with open(os.environ["GITHUB_STEP_SUMMARY"], "a") as f: | |
| f.write("\n".join(lines) + "\n") | |
| EOF | |
| code_style: | |
| name: Code Style | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.11 | |
| - name: Install nox | |
| run: pip install nox uv | |
| - name: Check code with ruff | |
| run: nox -s code_style | |
| check_todos: | |
| name: Check "TODO" Changes | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| permissions: | |
| pull-requests: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check "TODO" differences | |
| id: todo-diff | |
| uses: ./.github/actions/todo-diff | |
| with: | |
| base-ref: ${{ github.event.pull_request.base.sha }} | |
| head-ref: ${{ github.sha }} | |
| - name: Comment on PR with "TODO" changes | |
| if: steps.todo-diff.outputs.has-changes == 'true' | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const summary = `${{ steps.todo-diff.outputs.summary }}`; | |
| const details = ${{ steps.todo-diff.outputs.details }}; | |
| let commentBody = `## 📝 "TODO" Changes Detected\n\n**Summary:** ${summary}\n\n`; | |
| if (details.added && details.added.length > 0) { | |
| commentBody += `### ➕ Added "TODO"s (${details.added.length})\n`; | |
| for (const todo of details.added) { | |
| commentBody += `- \`${todo.file_path}:${todo.line_number}\`: ${todo.content}\n`; | |
| } | |
| commentBody += '\n'; | |
| } | |
| if (details.removed && details.removed.length > 0) { | |
| commentBody += `### ❌ Removed "TODO"s (${details.removed.length})\n`; | |
| for (const todo of details.removed) { | |
| commentBody += `- \`${todo.file_path}:${todo.line_number}\`: ${todo.content}\n`; | |
| } | |
| commentBody += '\n'; | |
| } | |
| if (details.modified && details.modified.length > 0) { | |
| commentBody += `### 📝 Modified "TODO"s (${details.modified.length})\n`; | |
| for (const todo of details.modified) { | |
| commentBody += `- \`${todo.file_path}:${todo.line_number}\`:\n`; | |
| commentBody += ` - **Before:** ${todo.old_content}\n`; | |
| commentBody += ` - **After:** ${todo.new_content}\n`; | |
| } | |
| commentBody += '\n'; | |
| } | |
| commentBody += '---\n*This comment is automatically updated when "TODO" changes are detected.*'; | |
| // Find existing TODO comment | |
| const comments = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const existingComment = comments.data.find(comment => | |
| comment.user.login === 'github-actions[bot]' && | |
| comment.body.includes('📝 "TODO" Changes Detected') | |
| ); | |
| if (existingComment) { | |
| // Update existing comment | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existingComment.id, | |
| body: commentBody | |
| }); | |
| } else { | |
| // Create new comment | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: commentBody | |
| }); | |
| } | |
| docs-build: | |
| name: Documentation Build | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.13' | |
| - name: Install nox and uv | |
| run: pip install nox uv | |
| - name: Build documentation | |
| run: nox -s docs |