arcade icon indicating copy to clipboard operation
arcade copied to clipboard

Poison bot commit messages

Open richlander opened this issue 1 year ago • 2 comments

We've talked about being able to better reason about commits and PRs. That's really hard, in part because of all the bot activity.

We should consider adding a marker to commits/PRs that should never participate in automated "Feature and fix reports". Many projects auto-generate lists of improvements directly out of GitHub. We do not.

As you can see, we have many bot-generated PRs.

https://github.com/dotnet/runtime/pulls/app%2Fdotnet-maestro

Certainly, we can block-list all the bot accounts.

We could also consider adding other markers for other purposes, like community PRs.

richlander avatar Feb 05 '24 23:02 richlander

community PR's should already have the community label auto-applied -- @jeffhandley does that happen through some GH action on all repos?

bots are generally "marked" as automation. so afaik, the GH API can be used to identify both.

danmoseley avatar Feb 06 '24 00:02 danmoseley

@danmoseley Many of our repositories use Policy Service to label community contributions, but this isn't centralized or uniform across the repositories. The label-prs.yml (dotnet/docs) policy is a good example though.

Policy Service can't detect bots through the user type, but it could have the list of authors we want to label as such. Alternatively, we could pursue a GitHub workflow with an implementation like this, that checks the type of user that authored the PR, triggering this when PRs are created:

jobs:
  label-bot-pr:
    runs-on: ubuntu-latest
    steps:
      - name: Label Bot PRs
        uses: actions/github-script@v5
        with:
          script: |
            const author = context.payload.pull_request.user;
            
            if (author.type == 'Bot') {
              const prNumber = context.payload.pull_request.number;
              console.log(`Labeling PR #${prNumber}. Author '${user.login}' is a Bot.`);
              
              await github.issues.addLabels({
                owner: context.repo.owner,
                repo: context.repo.repo,
                issue_number: prNumber,
                labels: ['bot'],
              });
            }

jeffhandley avatar Apr 25 '24 20:04 jeffhandley