Skip to content

[FEAT]: Support property based conditions for github_organization_ruleset #2594

Closed

Description

@secustor

Describe the need

Currently only a static repository list are allowed.

With this it would be possible to define dynamic lists of repositories based on properties of repositories in the organization

The following will apply a rule to all repositories which are not public

JSON representation of such a ruleset
{
  "id": 1111111,
  "name": "test",
  "target": "branch",
  "source_type": "Organization",
  "source": "foo",
  "enforcement": "evaluate",
  "conditions": {
    "ref_name": {
      "exclude": [],
      "include": [
        "~DEFAULT_BRANCH"
      ]
    },
    "repository_property": {
      "exclude": [
        {
          "name": "visibility",
          "source": "system",
          "property_values": [
            "public"
          ]
        }
      ],
      "include": []
    }
  },
  "rules": [
    {
      "type": "workflows",
      "parameters": {
        "do_not_enforce_on_create": true,
        "workflows": [
          {
            "repository_id": 0000000,
            "path": ".github/workflows/bar.yml",
            "ref": "refs/heads/main"
          }
        ]
      }
    }
  ],
  "node_id": "xxxxxxxxxxxx",
  "created_at": "2025-03-13T16:27:00.269+01:00",
  "updated_at": "2025-03-13T16:27:00.269+01:00",
  "bypass_actors": [],
  "_links": {
    "self": {
      "href": "https://api.github.com/orgs/n26/rulesets/1111111"
    },
    "html": {
      "href": "http://github.com/organizations/n26/settings/rules/1111111"
    }
  }
}

API endpoint: https://docs.github.com/en/rest/orgs/rules?apiVersion=2022-11-28#create-an-organization-repository-ruleset

SDK Version

No response

API Version

2022-11-28

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    Status: Triage
    Type: Feature
    on Mar 13, 2025
  2. moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Activeon Jun 3, 2025
  3. AlexaDeWit commented on Jul 24, 2025

    @AlexaDeWit
    Contributor

    Seconded. We've started rolling out organization wide policies but can't migrate some of them to TF, as we require use of the Repositories matching a filter pattern, which would allow us to enforce this policy only on our internal and private repositories.

    Your example around project visibility is coincidentally the exact same filter of interest for us

  4. rubengommers commented on Nov 12, 2025

    @rubengommers

    +1

  5. mperehinets-hacken commented on Nov 14, 2025

    @mperehinets-hacken

    +1

  6. added a commit that references this issue on Feb 27, 2026
    3439ad5
  7. moved this from Backlog to In Progress in Terraform Provideron Feb 27, 2026
  8. alexef commented on May 22, 2026

    @alexef

    fixed in #2356 ?

  9. moved this from In Progress to Done in Terraform Provideron May 22, 2026
  10. moved this from 🔥 Backlog to ✅ Done in 🧰 Octokit Activeon May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageType: Feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions