feat: integrate retry mechanisms and improvements into Factory AI wor… #29
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: 🤖 Auto-Assign Issues & PRs | ||
|
Check failure on line 1 in .github/workflows/auto-assign.yml
|
||
| on: | ||
| issues: | ||
| types: [opened] | ||
| pull_request: | ||
| types: [opened] | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - ".github/workflows/auto-assign.yml" | ||
| jobs: | ||
| noop: | ||
| name: 💤 No-op | ||
| runs-on: ubuntu-latest | ||
| if: ${{ github.event_name != 'issues' && github.event_name != 'pull_request' }} | ||
| steps: | ||
| - run: echo "Auto-assign workflow only handles issues and pull requests." | ||
| auto-assign: | ||
| runs-on: ubuntu-latest | ||
| if: ${{ github.event_name == 'issues' || github.event_name == 'pull_request' }} | ||
| steps: | ||
| - name: 👥 Auto-assign based on labels | ||
| uses: actions/github-script@v6 | ||
| with: | ||
| script: | | ||
| const core = require('@actions/core'); | ||
| const { context, github } = require('@actions/github'); | ||
| // Auto-assignment rules based on labels | ||
| const assignmentRules = { | ||
| 'bug': ['@maintainer1', '@qa-lead'], | ||
| 'security': ['@security-team', '@maintainer1'], | ||
| 'frontend': ['@frontend-team'], | ||
| 'backend': ['@backend-team'], | ||
| 'documentation': ['@docs-team'], | ||
| 'sprint-planning': ['@product-owner', '@scrum-master'] | ||
| }; | ||
| const item = context.payload.issue || context.payload.pull_request; | ||
| if (!item) { | ||
| core.info('No issue or pull request payload detected; skipping auto-assign.'); | ||
| return; | ||
| } | ||
| const labels = item.labels.map(label => label.name); | ||
| let assignees = new Set(); | ||
| // Check each label and add corresponding assignees | ||
| labels.forEach(label => { | ||
| if (assignmentRules[label]) { | ||
| assignmentRules[label].forEach(assignee => { | ||
| assignees.add(assignee.replace('@', '')); | ||
| }); | ||
| } | ||
| }); | ||
| // Assign if we found any matching assignees | ||
| if (assignees.size > 0) { | ||
| const params = { | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: item.number, | ||
| assignees: Array.from(assignees) | ||
| }; | ||
| if (context.payload.issue) { | ||
| await github.rest.issues.addAssignees(params); | ||
| } else { | ||
| await github.rest.pulls.requestReviewers({ | ||
| ...params, | ||
| pull_number: item.number, | ||
| reviewers: Array.from(assignees) | ||
| }); | ||
| } | ||
| } | ||
| add-to-project: | ||
| runs-on: ubuntu-latest | ||
| if: ${{ (github.event_name == 'issues' || github.event_name == 'pull_request') && secrets.PROJECT_TOKEN != '' }} | ||
| steps: | ||
| - name: 📋 Add to Project Board | ||
| uses: actions/add-to-project@v0.4.0 | ||
| with: | ||
| project-url: https://github.com/orgs/OWNER/projects/PROJECT_NUMBER | ||
| github-token: ${{ secrets.PROJECT_TOKEN }} | ||
| labeled: sprint-planning,bug,enhancement | ||
| label-operator: OR | ||