diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d93c064..d88bf22 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -15,6 +15,9 @@ updates: - "react-dom" dev-dependencies: dependency-type: development + ignore: + - dependency-name: eslint + update-types: ["version-update:semver-major"] - package-ecosystem: github-actions directory: / diff --git a/.github/workflows/branch-protection.yml b/.github/workflows/branch-protection.yml deleted file mode 100644 index 2dd6601..0000000 --- a/.github/workflows/branch-protection.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Branch protection - -on: - push: - branches: - - main - paths: - - .github/workflows/branch-protection.yml - workflow_dispatch: - -permissions: - administration: write - -jobs: - apply-ruleset: - name: Apply main branch ruleset - runs-on: ubuntu-latest - steps: - - name: Sync branch protection ruleset - uses: actions/github-script@v7 - with: - script: | - const RULESET_NAME = "Protect main"; - const REQUIRED_CHECKS = ["Lint and build"]; - - const { owner, repo } = context.repo; - - const rulesetPayload = { - name: RULESET_NAME, - target: "branch", - enforcement: "active", - conditions: { - ref_name: { - include: ["~DEFAULT_BRANCH"], - exclude: [], - }, - }, - rules: [ - { - type: "pull_request", - parameters: { - required_approving_review_count: 0, - dismiss_stale_reviews_on_push: false, - require_code_owner_review: false, - require_last_push_approval: false, - required_review_thread_resolution: false, - }, - }, - { type: "deletion" }, - { type: "non_fast_forward" }, - { - type: "required_status_checks", - parameters: { - strict_required_status_checks_policy: true, - do_not_enforce_on_create: false, - required_status_checks: REQUIRED_CHECKS.map((context) => ({ - context, - })), - }, - }, - ], - }; - - const { data: rulesets } = await github.request( - "GET /repos/{owner}/{repo}/rulesets", - { - owner, - repo, - headers: { "X-GitHub-Api-Version": "2022-11-28" }, - }, - ); - - const existing = rulesets.find((ruleset) => ruleset.name === RULESET_NAME); - - if (existing) { - await github.request("PUT /repos/{owner}/{repo}/rulesets/{ruleset_id}", { - owner, - repo, - ruleset_id: existing.id, - ...rulesetPayload, - headers: { "X-GitHub-Api-Version": "2022-11-28" }, - }); - core.info(`Updated ruleset "${RULESET_NAME}" (id: ${existing.id}).`); - return; - } - - const { data: created } = await github.request( - "POST /repos/{owner}/{repo}/rulesets", - { - owner, - repo, - ...rulesetPayload, - headers: { "X-GitHub-Api-Version": "2022-11-28" }, - }, - ); - - core.info(`Created ruleset "${RULESET_NAME}" (id: ${created.id}).`); diff --git a/package.json b/package.json index f2e088d..1f9629a 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "@types/node": "^20", "@types/react": "^19", "@types/react-dom": "^19", - "eslint": "^9", + "eslint": "^9.0.0", "eslint-config-next": "16.2.6", "tailwindcss": "^4", "typescript": "^5"