Skip to content

Update Danger setup to run via Buildkite + Add RuboCop linter #627

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

Merged
merged 6 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,22 @@ steps:
plugins: [*docker_plugin]
agents:
queue: "default"

- group: "Linters"
steps:
- label: ☢️ Danger - PR Check
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the branch requirements to use this name.

As a follow up, I shall open a new PR implementing the custom GitHub commit status names.

command: danger
key: danger
if: build.pull_request.id != null
retry:
manual:
permit_on_passed: true
agents:
queue: linter

- label: ":rubocop: Rubocop"
command: rubocop
key: rubocop
if: build.pull_request.id != null
agents:
queue: linter
17 changes: 11 additions & 6 deletions .github/workflows/run-danger.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
name: ☢️ Danger
name: ☢️ Trigger Danger On Buildkite

on:
pull_request:
types: [opened, reopened, ready_for_review, synchronize, edited, review_requested, review_request_removed, labeled, unlabeled, milestoned, demilestoned]
types: [labeled, unlabeled, milestoned, demilestoned, review_requested, review_request_removed]

jobs:
dangermattic:
# runs on draft PRs only for opened / synchronize events
if: ${{ (github.event.pull_request.draft == false) || (github.event.pull_request.draft == true && contains(fromJSON('["opened", "synchronize"]'), github.event.action)) }}
uses: Automattic/dangermattic/.github/workflows/reusable-run-danger.yml@v1.0.0
if: ${{ (github.event.pull_request.draft == false) }}
uses: Automattic/dangermattic/.github/workflows/reusable-retry-buildkite-step-on-events.yml@v1
with:
org-slug: automattic
pipeline-slug: release-toolkit
retry-step-key: danger
build-commit-sha: ${{ github.event.pull_request.head.sha }}
cancel-running-github-jobs: false
secrets:
github-token: ${{ secrets.DANGERMATTIC_GITHUB_TOKEN }}
buildkite-api-token: ${{ secrets.TRIGGER_BK_BUILD_TOKEN }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice that this workflow didn't kick in for this PR, as you can see by the fact that the Dangermattic comment still mentions the PR being a draft. But that's because for it to run it needs to land on trunk.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎗️ To add TRIGGER_BK_BUILD_TOKEN to the GHA secrets in this repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks for the reminder!

image