Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore certain branches #51

Open
trevor-scheer opened this issue Mar 3, 2022 · 1 comment
Open

Ignore certain branches #51

trevor-scheer opened this issue Mar 3, 2022 · 1 comment

Comments

@trevor-scheer
Copy link

Is it possible to configure the app behavior per repo via .changeset/config.json (or some other way)? If so, it would be nice to filter branches that the bot acts on, i.e. there's no need to leave a comment on renovate/* branches.

@humphd
Copy link

humphd commented Nov 26, 2024

This would be great. Looking through the code, I notice that the bot already can read the .changeset/config.json:

https://github.com/changesets/bot/blob/master/get-changed-packages.ts#L72

Given that, it would be cool if you could include a whitelist of branches in the config, then read it out and filter on those names when the bot runs in https://github.com/changesets/bot/blob/master/index.ts#L135?

  app.on(
    ["pull_request.opened", "pull_request.synchronize"],
    async (context) => {
      // Get the target branch (base branch) of the PR
      const targetBranch = context.payload.pull_request.base.ref;
      
      // Get the branches from the config somehow...
      const allowedBranches = ['main', 'develop', 'staging'];
      
      // Check if the target branch is in the allowed list
      if (!allowedBranches.includes(targetBranch)) {
        app.log.info(`Skipping PR for branch ${targetBranch} - not in allowed list`);
        return;
      }

Not sure if this is doable, I haven't worked with probot before, but the code seems to imply it could.

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

No branches or pull requests

2 participants