From f8d66dcebb31b5ec6850b4203ff943ef8d5036e7 Mon Sep 17 00:00:00 2001 From: David Apirian Date: Tue, 1 Oct 2024 11:41:39 -0700 Subject: [PATCH] Better defaults and basic usage doc (#119966) --- .config/mq.toml | 3 +-- .github/workflows/factory.yaml | 32 +++++++++----------------------- README.md | 12 ++++++++++++ 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/.config/mq.toml b/.config/mq.toml index 839d9e975d1f..7d0a5bfa7b24 100644 --- a/.config/mq.toml +++ b/.config/mq.toml @@ -1,4 +1,3 @@ - mode = "singlequeue" [trunk] @@ -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" diff --git a/.github/workflows/factory.yaml b/.github/workflows/factory.yaml index 95df8b85cc90..8ad5bed0cc2c 100644 --- a/.github/workflows/factory.yaml +++ b/.github/workflows/factory.yaml @@ -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: @@ -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: @@ -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 }} diff --git a/README.md b/README.md index 0fd2fc997f3a..97aeda037a78 100644 --- a/README.md +++ b/README.md @@ -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