From 5e8d6fb790226a2ff519ca8ac9f7da4f3c5a11da Mon Sep 17 00:00:00 2001 From: Saq Imtiaz Date: Sun, 4 May 2025 16:22:00 +0200 Subject: [PATCH 1/2] Adds a custom action to check the target branch (#9046) * ci: added cerebrus action to validate files in PRs based on the target branch * fix: reflect move of action repo to TW org * use cerebrus v2 * fix: use pull_request_target to enable write access --- .github/workflows/pr-path-validation.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/pr-path-validation.yml diff --git a/.github/workflows/pr-path-validation.yml b/.github/workflows/pr-path-validation.yml new file mode 100644 index 000000000..570db8463 --- /dev/null +++ b/.github/workflows/pr-path-validation.yml @@ -0,0 +1,18 @@ +name: Validate PR Paths + +on: + pull_request_target: + types: [opened, reopened, synchronize] + +jobs: + validate-pr: + runs-on: ubuntu-latest + + steps: + - name: Validate PR + uses: TiddlyWiki/cerebrus@v2 + with: + pr_number: ${{ github.event.pull_request.number }} + repo: ${{ github.repository }} + base_ref: ${{ github.base_ref }} + github_token: ${{ secrets.GITHUB_TOKEN }} From 1480d495b326928b7a44726eb62f7c7c1daab1e7 Mon Sep 17 00:00:00 2001 From: Saq Imtiaz Date: Mon, 5 May 2025 13:00:11 +0200 Subject: [PATCH 2/2] ci: use v3 of cerebrus that also posts a build size report to PRs (#9048) --- .github/workflows/pr-check-build-size.yml | 18 ++++++++++++++++ .github/workflows/pr-comment-build-size.yml | 23 +++++++++++++++++++++ .github/workflows/pr-path-validation.yml | 2 +- 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pr-check-build-size.yml create mode 100644 .github/workflows/pr-comment-build-size.yml diff --git a/.github/workflows/pr-check-build-size.yml b/.github/workflows/pr-check-build-size.yml new file mode 100644 index 000000000..034349171 --- /dev/null +++ b/.github/workflows/pr-check-build-size.yml @@ -0,0 +1,18 @@ +name: Calculate PR build size +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + calculate-build-size: + runs-on: ubuntu-latest + + steps: + - name: Build and check size + uses: saqimtiaz/cerebrus@v3 + with: + pr_number: ${{ github.event.pull_request.number }} + repo: ${{ github.repository }} + base_ref: ${{ github.base_ref }} + github_token: ${{ secrets.GITHUB_TOKEN }} + mode: size:calc \ No newline at end of file diff --git a/.github/workflows/pr-comment-build-size.yml b/.github/workflows/pr-comment-build-size.yml new file mode 100644 index 000000000..8680fe770 --- /dev/null +++ b/.github/workflows/pr-comment-build-size.yml @@ -0,0 +1,23 @@ +name: Comment on PR build size (Trusted workflow) + +on: + repository_dispatch: + types: [pr_build_size_report] + +jobs: + comment-build-size-on-pr: + runs-on: ubuntu-latest + permissions: + pull-requests: write + + steps: + - name: Build and check size + uses: TiddlyWiki/cerebrus@v3 + with: + pr_number: ${{ github.event.client_payload.pr_number }} + repo: ${{ github.repository }} + base_ref: ${{ github.event.client_payload.base_branch }} + github_token: ${{ secrets.GITHUB_TOKEN }} + mode: size:comment + pr_size: ${{ github.event.client_payload.pr_size }} + base_size: ${{ github.event.client_payload.base_size }} \ No newline at end of file diff --git a/.github/workflows/pr-path-validation.yml b/.github/workflows/pr-path-validation.yml index 570db8463..100101970 100644 --- a/.github/workflows/pr-path-validation.yml +++ b/.github/workflows/pr-path-validation.yml @@ -10,7 +10,7 @@ jobs: steps: - name: Validate PR - uses: TiddlyWiki/cerebrus@v2 + uses: TiddlyWiki/cerebrus@v3 with: pr_number: ${{ github.event.pull_request.number }} repo: ${{ github.repository }}