mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-09-13 00:06:04 +00:00
Resolves permissions issues in workflow to check PR build size (#9049)
* ci: use v3 of cerebrus that also posts a build size report to PRs * fix: resolved permissions issues in checking PR build size
This commit is contained in:
40
.github/workflows/pr-check-build-size.yml
vendored
40
.github/workflows/pr-check-build-size.yml
vendored
@@ -1,18 +1,50 @@
|
|||||||
name: Calculate PR build size
|
name: Calculate PR build size
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request_target:
|
||||||
types: [opened, reopened, synchronize]
|
types: [opened, reopened, synchronize]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
calculate-build-size:
|
calculate-build-size:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pull-requests: read
|
||||||
|
contents: read
|
||||||
|
outputs:
|
||||||
|
pr_size: ${{ steps.get_sizes.outputs.pr_size }}
|
||||||
|
base_size: ${{ steps.get_sizes.outputs.base_size }}
|
||||||
steps:
|
steps:
|
||||||
- name: Build and check size
|
- name: build-size-check
|
||||||
uses: saqimtiaz/cerebrus@v3
|
id: get_sizes
|
||||||
|
uses: TiddlyWiki/cerebrus@v4
|
||||||
with:
|
with:
|
||||||
pr_number: ${{ github.event.pull_request.number }}
|
pr_number: ${{ github.event.pull_request.number }}
|
||||||
repo: ${{ github.repository }}
|
repo: ${{ github.repository }}
|
||||||
base_ref: ${{ github.base_ref }}
|
base_ref: ${{ github.base_ref }}
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
mode: size:calc
|
mode: size:calc
|
||||||
|
|
||||||
|
dispatch-followup:
|
||||||
|
needs: calculate-build-size
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
actions: write # Required to dispatch another workflow
|
||||||
|
pull-requests: write
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- name: Trigger follow-up workflow
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
script: |
|
||||||
|
await github.rest.actions.createWorkflowDispatch({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
workflow_id: 'pr-comment-build-size.yml',
|
||||||
|
ref: 'master',
|
||||||
|
inputs: {
|
||||||
|
pr_number: '${{ github.event.pull_request.number }}',
|
||||||
|
base_ref: '${{ github.event.pull_request.base.ref }}',
|
||||||
|
pr_size: '${{ needs.calculate-build-size.outputs.pr_size }}',
|
||||||
|
base_size: '${{ needs.calculate-build-size.outputs.base_size }}'
|
||||||
|
}
|
||||||
|
});
|
29
.github/workflows/pr-comment-build-size.yml
vendored
29
.github/workflows/pr-comment-build-size.yml
vendored
@@ -1,23 +1,36 @@
|
|||||||
name: Comment on PR build size (Trusted workflow)
|
name: Comment on PR build size (Trusted workflow)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
repository_dispatch:
|
workflow_dispatch:
|
||||||
types: [pr_build_size_report]
|
inputs:
|
||||||
|
pr_number:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
base_ref:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
pr_size:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
base_size:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
comment-build-size-on-pr:
|
comment-on-pr:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Build and check size
|
- name: Build and check size
|
||||||
uses: TiddlyWiki/cerebrus@v3
|
uses: TiddlyWiki/cerebrus@v4
|
||||||
with:
|
with:
|
||||||
pr_number: ${{ github.event.client_payload.pr_number }}
|
pr_number: ${{ inputs.pr_number }}
|
||||||
repo: ${{ github.repository }}
|
repo: ${{ github.repository }}
|
||||||
base_ref: ${{ github.event.client_payload.base_branch }}
|
base_ref: ${{ inputs.base_ref }}
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
mode: size:comment
|
mode: size:comment
|
||||||
pr_size: ${{ github.event.client_payload.pr_size }}
|
pr_size: ${{ inputs.pr_size }}
|
||||||
base_size: ${{ github.event.client_payload.base_size }}
|
base_size: ${{ inputs.base_size }}
|
||||||
|
2
.github/workflows/pr-path-validation.yml
vendored
2
.github/workflows/pr-path-validation.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Validate PR
|
- name: Validate PR
|
||||||
uses: TiddlyWiki/cerebrus@v3
|
uses: TiddlyWiki/cerebrus@v4
|
||||||
with:
|
with:
|
||||||
pr_number: ${{ github.event.pull_request.number }}
|
pr_number: ${{ github.event.pull_request.number }}
|
||||||
repo: ${{ github.repository }}
|
repo: ${{ github.repository }}
|
||||||
|
Reference in New Issue
Block a user