Open temichelle13 opened 1 month ago
The task involves updating the project settings for the StudyPlanner repository, including enabling issues, discussions, project boards, and setting up branch protection rules. This can be achieved by configuring the .github/settings.yml
file and creating a GitHub Actions workflow to enforce branch protection rules.
.github/settings.yml
This file will configure the repository settings to enable issues, discussions, project boards, and set branch protection rules.
.github/settings.yml
# Repository Settings
repository:
issues: true
discussions: true
projects: true
wiki: false
# Branch Protection Rules
branches:
- name: main
protection:
required_status_checks:
strict: true
contexts: []
enforce_admins: true
required_pull_request_reviews:
dismissal_restrictions:
users: []
teams: []
dismiss_stale_reviews: true
require_code_owner_reviews: true
required_approving_review_count: 2
restrictions:
users: []
teams: []
apps: []
required_linear_history: true
allow_force_pushes: false
allow_deletions: false
# Additional repository settings
repository:
default_branch: main
visibility: public
topics: ["study-planner", "education", "productivity"]
description: "A project to help students plan their study schedules effectively."
homepage: "https://example.com/studyplanner"
Repository Settings:
Branch Protection Rules:
main
branch.Additional Settings:
main
..github/workflows/branch-protection.yml
This workflow will ensure branch protection rules are applied using GitHub Actions.
.github/workflows/branch-protection.yml
name: Branch Protection Rules
on:
push:
branches:
- main
workflow_dispatch:
jobs:
apply-branch-protection:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Apply branch protection rules
uses: octokit/request-action@v2.x
with:
route: PATCH /repos/:owner/:repo/branches/:branch/protection
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
branch: main
mediaType: '{"previews":["luke-cage"]}'
protection: |
{
"required_status_checks": {
"strict": true,
"contexts": []
},
"enforce_admins": true,
"required_pull_request_reviews": {
"dismiss_stale_reviews": true,
"require_code_owner_reviews": true,
"required_approving_review_count": 2
},
"restrictions": null,
"required_linear_history": true,
"allow_force_pushes": false,
"allow_deletions": false
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
main
branch and can also be manually triggered.actions/checkout@v2
to check out the repository.octokit/request-action@v2.x
to send a PATCH request to the GitHub API to apply branch protection rules..github/settings.yml
file in your repository and add the provided YAML configuration..github/workflows/branch-protection.yml
file in your repository and add the provided YAML configuration.This setup will ensure that the repository settings are updated and branch protection rules are enforced for the main
branch.
Click here to create a Pull Request with the proposed solution
Files used for this task:
This task involves updating the project settings for the StudyPlanner repository, including branch protection rules, enabling issues and discussions, and setting up project boards.