Skip to content

Add app_slug support to required_status_checks - #67

Closed
ppkarwasz wants to merge 6 commits into
apache:mainfrom
ppkarwasz:feat/app_slug
Closed

ppkarwasz wants to merge 6 commits into
apache:mainfrom
ppkarwasz:feat/app_slug

Conversation

@ppkarwasz

Copy link
Copy Markdown
Member

This adds the possibility to use application slugs instead of application numerical ids to specify the required checks for a PR.

The slugs for third-party GitHub apps can be found on [GitHub Marketplace]. All slugs can be checked by accessing https://github.com/apps/<app_slug>.

Two common internal GitHub apps are github-actions and github-advanced-security and can be used as in the example below:

github:
  protected_branches:
    main:
      required_status_checks:
        checks:
          # A Github Actions workflow name that must pass
          - context: build / build (ubuntu-latest)
            app_slug: github-actions
          # A security check that must pass
          - context: CodeQL
            app_slug: github-advanced-security

Closes #65

ppkarwasz and others added 2 commits April 12, 2025 16:49
This adds the possibility to use application slugs instead of application numerical ids to specify the required checks for a PR.

The slugs for third-party GitHub apps can be found on [GitHub Marketplace]. All slugs can be checked by accessing `https://github.com/apps/<app_slug>`.

Two common examples of internal GitHub apps are `github-actions` and `github-advanced-security`.

```yaml
github:
  protected_branches:
    main:
      required_status_checks:
        checks:
          # A Github Actions workflow name that must pass
          - context: build / build (ubuntu-latest)
            app_slug: github-actions
          # A security check that must pass
          - context: CodeQL
            app_slug: github-advanced-security
```

Closes apache#65
@netomi

netomi commented Apr 13, 2025

Copy link
Copy Markdown
Member

I have now been reading up the README and the code, and we make the distinction between a context and a check, where a context is just using an app_id of -1 by default, while this is now also the default for checks. So that is redundant, and probably should be merged into one only.

@ppkarwasz

Copy link
Copy Markdown
Member Author

Should we deprecated contexts? How do we do that? Can we check if anybody uses it?

@netomi

netomi commented Apr 13, 2025

Copy link
Copy Markdown
Member

@ppkarwasz

Copy link
Copy Markdown
Member Author

OK, so let's modify the schema to accept both:

required_status_checks:
  contexts:
    - "string1"
    - "string2"

and

required_status_checks:
  contexts:
    - context: "string1"
      app_slug: "github-actions"
    - context: "CodeQL"
      app_slug: "github-advanced-security"

There is no need to keep supporting app_id.

@netomi

netomi commented Apr 13, 2025

Copy link
Copy Markdown
Member

what about

required_status_checks:
  contexts:
    - name: "string1"
      app: "github-actions"
    - name: "CodeQL"
      app: 121212

app can either be a string or int. If its a string it will be resolved to its id.

In the simple case you would provide just a list of names to contexts:

required_status_checks:
  contexts:
    - "string1"
    - "string2"

@ppkarwasz

Copy link
Copy Markdown
Member Author

Looks good to me.

@ppkarwasz
ppkarwasz marked this pull request as draft April 13, 2025 20:16
@netomi

netomi commented Apr 13, 2025

Copy link
Copy Markdown
Member

@Humbedooh wdyt? about the suggested cleanup of the status check format as described above?

@netomi

netomi commented Apr 14, 2025

Copy link
Copy Markdown
Member

I merged in the branch for supporting environments. For that we also added a reference to the PyGithub object for later use, will massage this PR to use the same mechanism.

@ppkarwasz
ppkarwasz marked this pull request as ready for review April 14, 2025 19:41
@ppkarwasz

Copy link
Copy Markdown
Member Author

@netomi,

I applied the suggested changes.

@netomi

netomi commented Apr 15, 2025 •

Copy link
Copy Markdown
Member

LGTM, great work

Feels much cleaner now and easier imho.

@Humbedooh

Copy link
Copy Markdown
Member

There are some projects (Logging among others) that use the app_id tag extensively, so I'd like to give them a heads up before we merge this in. I'll send that out now, and I expect we can merge this in a day or so.

@Humbedooh

Copy link
Copy Markdown
Member

or do you want to just handle that, @ppkarwasz ?

@ppkarwasz

Copy link
Copy Markdown
Member Author

For Logging I will handle it, but you should warn the other projects.

@ppkarwasz

Copy link
Copy Markdown
Member Author

@Humbedooh,

Any plan on how to deploy this? As far as I understand, deploying this will only affect Logging, since its .asf.yaml file will no longer validate. This should be no problem, since we'll fix it as soon as possible.

@dave2wave

Copy link
Copy Markdown
Member

@Humbedooh Is this PR no longer desirable since rulesets are supported?

@ppkarwasz

Copy link
Copy Markdown
Member Author

Nice catch!

The Rulesets handler support app_slug. I am closing this.

@ppkarwasz ppkarwasz closed this May 3, 2026
@ppkarwasz
ppkarwasz deleted the feat/app_slug branch May 3, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add app_slug support to required_status_checks

4 participants