Skip to content

Commit

Permalink
Better defaults and basic usage doc (#119966)
Browse files Browse the repository at this point in the history
  • Loading branch information
dapirian authored Oct 1, 2024
1 parent 4d9a019 commit f8d66dc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
3 changes: 1 addition & 2 deletions .config/mq.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

mode = "singlequeue"

[trunk]
Expand All @@ -14,7 +13,7 @@ flake_rate = 0.10
sleep_for = "10m"

[pullrequest]
labels = "bot-pr" # label to apply to pull request on creation (comma separated list)
labels = "" # label to apply to pull request on creation (comma separated list)
comment = ""
requests_per_hour = 20 # target number of pull requests per hour
run_generate_for = "30 minutes"
Expand Down
32 changes: 9 additions & 23 deletions .github/workflows/factory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ name: PR Factory

on:
workflow_dispatch: {}
# Uncomment the following cron schedule to run this workflow every 30 minutes
# schedule:
# - cron: 0/30 * * * *
# Uncomment the following cron schedule to run this workflow every 30 minutes
# schedule:
# - cron: 0/30 * * * *

permissions:
pull-requests: write
contents: write

jobs:
create-pr:
Expand All @@ -16,24 +20,6 @@ jobs:
with:
ref: main

- name: choose secret
id: choose-secret
run: |
case $(( RANDOM % 3 )) in
0)
echo "secret_name=ELI_PAT" >> $GITHUB_OUTPUT
echo "Impersonating Eli"
;;
1)
echo "secret_name=ELI_PAT" >> $GITHUB_OUTPUT
echo "Impersonating Eli"
;;
2)
echo "secret_name=ELI_PAT" >> $GITHUB_OUTPUT
echo "Impersonating Eli"
;;
esac
- name: trunk install
uses: trunk-io/trunk-action/install@v1
with:
Expand All @@ -51,11 +37,11 @@ jobs:
id: edits
run: ./mq generate
env:
GH_TOKEN: ${{ secrets[steps.choose-secret.outputs.secret_name] }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: run mq
if: always()
id: clean
run: ./mq housekeeping
env:
GH_TOKEN: ${{ secrets[steps.choose-secret.outputs.secret_name] }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
This repository is used to demonstrate the performance characteristics of a merge graph under
different simulated loads.

#### Usage

1. Fork this repo
2. Follow the instructions in the
[docs.trunk.io](https://docs.trunk.io/merge-queue/set-up-trunk-merge) to set up a merge queue for
your forked repo
3. Go to the actions tab of your forked repo and enable running github actions
4. In the actions tab, go to the `PR Factory` workflow and click on `Run workflow` on `main`. Note:
this will run a 30 minute merge queue simulation, but you can also uncomment the cron job in
`.github/workflows/pr-factory.yaml` to run the simulation indefinitely.
5. Go back to app.trunk.io and witness the merge queue in action

#### How does it work

The load imparted onto the connected queue is controlled by the `mq.toml` file in the .config
Expand Down

0 comments on commit f8d66dc

Please sign in to comment.