You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when someone wants to work on a thingport, a zopen admin has to manually create a repo and setup the necessary access to the new repo for the contributor.
With GH actions and a new issue template, this can be automated.
Proposed Solution & Expected Behavior
Haven't checked if this exact code works but it uses actions/github-script and GH CLI.
issue-template.yaml:
name: Trigger Repository Creationdescription: Use this template to request a new repository based on specific criteria.title: "Create new repo for [Project Name]"labels: ["repo-creation-request"]body:
- type: markdownattributes:
value: | ### Guidelines - Use this template to request a new repository where the project name should be included in the title. - **Important**: Include the word "Trigger" in the title to activate the automation.
- type: textareaid: repo-nameattributes:
label: Repository Namedescription: Please enter the desired name for the new repository.placeholder: Example: my-new-projectvalidations:
required: true
- type: textareaid: descriptionattributes:
label: Descriptiondescription: Describe the purpose or content of the repository.validations:
required: false
create-repo:
name: Create Repository Based on Issueon:
issues:
types: [opened, labeled]jobs:
check_issue:
runs-on: ubuntu-latestif: contains(github.event.issue.title, 'Trigger')steps:
- name: Check if issue contains the trigger wordrun: echo "Issue contains 'Trigger'. Proceeding with review request."add_reviewer:
runs-on: ubuntu-latestneeds: check_issuesteps:
- name: Add Revieweruses: actions/github-script@v6with:
github-token: ${{secrets.GITHUB_TOKEN}}script: | github.rest.issues.addAssignees({ issue_number: context.issue.number, assignees: ['x'] })create_repo:
runs-on: ubuntu-latestneeds: add_reviewerif: ${{ github.event.action == 'labeled' && github.event.label.name == 'approved' }}steps:
- name: Parse Issue for Repo Nameid: parseuses: actions/github-script@v6with:
github-token: ${{secrets.GITHUB_TOKEN}}script: | const issueBody = context.payload.issue.body; const repoNameMatch = issueBody.match(/Repository Name:\s*([^\n\r]+)/m); if (repoNameMatch) { return repoNameMatch[1].trim(); } throw new Error('Repository name not found in issue body');
- name: Create repositoryenv:
REPO_NAME: ${{ steps.parse.outputs.result }}GH_TOKEN: ${{ secrets.GITHUB_PAT }}run: | gh repo create orgo/$REPO_NAME --public --description "New repo created via automation" gh api -X PUT /repos/orgo/$REPO_NAME/collaborators/${{ github.event.issue.user.login }} -f permission=admin
Environment Details (Optional)
No response
Additional Information (Optional)
No response
The text was updated successfully, but these errors were encountered:
Feature Title
autorepo
Feature Description & Current Pain Points
Currently, when someone wants to work on a
thingport
, a zopen admin has to manually create a repo and setup the necessary access to the new repo for the contributor.With GH actions and a new issue template, this can be automated.
Proposed Solution & Expected Behavior
Haven't checked if this exact code works but it uses actions/github-script and GH CLI.
issue-template.yaml:
create-repo:
Environment Details (Optional)
No response
Additional Information (Optional)
No response
The text was updated successfully, but these errors were encountered: