From 33f4cccb64e43d1a8a8b90638880aca6fbb33444 Mon Sep 17 00:00:00 2001 From: David Apirian Date: Tue, 1 Oct 2024 11:04:42 -0700 Subject: [PATCH 1/6] Update factory.yaml --- .github/workflows/factory.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/factory.yaml b/.github/workflows/factory.yaml index 95df8b85cc90..5104a1c9fc6f 100644 --- a/.github/workflows/factory.yaml +++ b/.github/workflows/factory.yaml @@ -3,8 +3,8 @@ name: PR Factory on: workflow_dispatch: {} # Uncomment the following cron schedule to run this workflow every 30 minutes -# schedule: -# - cron: 0/30 * * * * + schedule: + - cron: 0/30 * * * * jobs: create-pr: From cdbf56f4fe5d59a797caeade19856f81dfa5acf7 Mon Sep 17 00:00:00 2001 From: David Apirian Date: Tue, 1 Oct 2024 11:24:17 -0700 Subject: [PATCH 2/6] --- .github/workflows/factory.yaml | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/.github/workflows/factory.yaml b/.github/workflows/factory.yaml index 5104a1c9fc6f..01acebd00083 100644 --- a/.github/workflows/factory.yaml +++ b/.github/workflows/factory.yaml @@ -2,7 +2,7 @@ name: PR Factory on: workflow_dispatch: {} -# Uncomment the following cron schedule to run this workflow every 30 minutes + # Uncomment the following cron schedule to run this workflow every 30 minutes schedule: - cron: 0/30 * * * * @@ -16,24 +16,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 +33,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 }} From 5ecc55c6c42e3c4b8d6865e0d98b05d19d26b541 Mon Sep 17 00:00:00 2001 From: David Apirian Date: Tue, 1 Oct 2024 11:27:45 -0700 Subject: [PATCH 3/6] --- .github/workflows/factory.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/factory.yaml b/.github/workflows/factory.yaml index 01acebd00083..8e1d3030c27f 100644 --- a/.github/workflows/factory.yaml +++ b/.github/workflows/factory.yaml @@ -6,6 +6,10 @@ on: schedule: - cron: 0/30 * * * * +permissions: + pull-requests: write + contents: write + jobs: create-pr: # needs: merge-pr From f1f95b26609d0aee12f90363d0522aa4e10a6e09 Mon Sep 17 00:00:00 2001 From: David Apirian Date: Tue, 1 Oct 2024 11:32:39 -0700 Subject: [PATCH 4/6] --- .config/mq.toml | 3 +-- 1 file changed, 1 insertion(+), 2 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" From 68d3dc70b0907e9cc734f46db2291a2e2257db1e Mon Sep 17 00:00:00 2001 From: David Apirian Date: Tue, 1 Oct 2024 11:39:44 -0700 Subject: [PATCH 5/6] --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 From ae7625995bae88fc20a9b9c7a95b49558c0f5c06 Mon Sep 17 00:00:00 2001 From: David Apirian Date: Tue, 1 Oct 2024 11:40:43 -0700 Subject: [PATCH 6/6] --- .github/workflows/factory.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/factory.yaml b/.github/workflows/factory.yaml index 8e1d3030c27f..8ad5bed0cc2c 100644 --- a/.github/workflows/factory.yaml +++ b/.github/workflows/factory.yaml @@ -3,8 +3,8 @@ name: PR Factory on: workflow_dispatch: {} # Uncomment the following cron schedule to run this workflow every 30 minutes - schedule: - - cron: 0/30 * * * * + # schedule: + # - cron: 0/30 * * * * permissions: pull-requests: write