diff --git a/.github/ISSUE_TEMPLATE/task.yml b/.github/ISSUE_TEMPLATE/task.yml new file mode 100644 index 0000000000..1ee2e5f644 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/task.yml @@ -0,0 +1,53 @@ +name: Task +description: For staff only - Create a task +type: Task +body: + - type: markdown + attributes: + value: | + ## ⚠️ RESTRICTED ACCESS + + **This form is restricted to Open Home Foundation staff and authorized contributors only.** + + If you are a community member wanting to contribute, please: + - For bug reports: Use the [bug report form](https://github.com/home-assistant/frontend/issues/new?template=bug_report.yml) + - For feature requests: Submit to [Feature Requests](https://github.com/orgs/home-assistant/discussions) + + --- + + ### For authorized contributors + + Use this form to create tasks for development work, improvements, or other actionable items that need to be tracked. + - type: textarea + id: description + attributes: + label: Description + description: | + Provide a clear and detailed description of the task that needs to be accomplished. + + Be specific about what needs to be done, why it's important, and any constraints or requirements. + placeholder: | + Describe the task, including: + - What needs to be done + - Why this task is needed + - Expected outcome + - Any constraints or requirements + validations: + required: true + - type: textarea + id: additional_context + attributes: + label: Additional context + description: | + Any additional information, links, research, or context that would be helpful. + + Include links to related issues, research, prototypes, roadmap opportunities etc. + placeholder: | + - Roadmap opportunity: [link] + - Epic: [link] + - Feature request: [link] + - Technical design documents: [link] + - Prototype/mockup: [link] + - Dependencies: [links] + validations: + required: false diff --git a/.github/workflows/restrict-task-creation.yml b/.github/workflows/restrict-task-creation.yml new file mode 100644 index 0000000000..c67230644e --- /dev/null +++ b/.github/workflows/restrict-task-creation.yml @@ -0,0 +1,58 @@ +name: Restrict task creation + +# yamllint disable-line rule:truthy +on: + issues: + types: [opened] + +jobs: + check-authorization: + runs-on: ubuntu-latest + # Only run if this is a Task issue type (from the issue form) + if: github.event.issue.issue_type == 'Task' + steps: + - name: Check if user is authorized + uses: actions/github-script@v7 + with: + script: | + const issueAuthor = context.payload.issue.user.login; + + // Check if user is an organization member + try { + await github.rest.orgs.checkMembershipForUser({ + org: 'home-assistant', + username: issueAuthor + }); + console.log(`✅ ${issueAuthor} is an organization member`); + return; // Authorized + } catch (error) { + console.log(`❌ ${issueAuthor} is not authorized to create Task issues`); + } + + // Close the issue with a comment + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: `Hi @${issueAuthor}, thank you for your contribution!\n\n` + + `Task issues are restricted to Open Home Foundation staff and authorized contributors.\n\n` + + `If you would like to:\n` + + `- Report a bug: Please use the [bug report form](https://github.com/home-assistant/frontend/issues/new?template=bug_report.yml)\n` + + `- Request a feature: Please submit to [Feature Requests](https://github.com/orgs/home-assistant/discussions)\n\n` + + `If you believe you should have access to create Task issues, please contact the maintainers.` + }); + + await github.rest.issues.update({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + state: 'closed' + }); + + // Add a label to indicate this was auto-closed + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: ['auto-closed'] + });