Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove Rich Harris as commenter on preview comments #1120

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 29 additions & 25 deletions .github/workflows/docs-preview-create.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
name: Docs preview create

on:
repository_dispatch:
types: [docs-preview-create]
workflow_dispatch:
inputs:
repo:
description: 'Repository name (not fully-qualified, eg. `svelte` or `kit`)'
required: true
type: string
pr:
description: 'PR number'
required: true
type: string
owner:
description: 'Owner (eg. sveltejs)'
required: true
type: string
branch:
description: 'Branch (eg. my-feature-branch)'
required: true
type: string

env:
BRANCH: preview-${{ github.event.client_payload.package }}-${{ github.event.client_payload.pr }}
BRANCH: preview-${{ inputs.repo }}-${{ inputs.pr }}

jobs:
Sync:
name: Sync
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -25,7 +42,7 @@ jobs:
run: git fetch origin ${{ env.BRANCH }} && git checkout ${{ env.BRANCH }} || git checkout -b ${{ env.BRANCH }}

- name: Sync
run: cd apps/svelte.dev && pnpm sync-docs --owner="${{ github.event.client_payload.owner }}" -p "${{ github.event.client_payload.package }}#${{ github.event.client_payload.branch }}"
run: cd apps/svelte.dev && pnpm sync-docs --owner="${{ inputs.owner }}" -p "${{ inputs.repo }}#${{ inputs.branch }}"

- name: Configure Git
run: |
Expand All @@ -36,25 +53,12 @@ jobs:
id: push
run: git add -A && git commit -m "sync docs" && git push -u origin ${{ env.BRANCH }}

- name: Find comment
id: fc
uses: peter-evans/find-comment@v3
- name: Request preview comment
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.COMMENTER_TOKEN }}
repository: ${{ github.event.client_payload.repo }}
issue-number: ${{ github.event.client_payload.pr }}
comment-author: 'Rich-Harris' # it's using my personal access token, not sure if there's a way to comment as a bot instead
body-includes: _this is an automated message_

- name: Create comment
if: steps.fc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.COMMENTER_TOKEN }}
repository: ${{ github.event.client_payload.repo }}
issue-number: ${{ github.event.client_payload.pr }}
body: |
preview: https://svelte-dev-git-${{ env.BRANCH }}-svelte.vercel.app/

_this is an automated message_
edit-mode: replace
event-type: 'request-preview-comment'
client-payload: |-
{
"repo": "${{ inputs.repo }}",
"pr": "${{ inputs.pr }}",
}
14 changes: 11 additions & 3 deletions .github/workflows/docs-preview-delete.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
name: Docs preview delete

on:
repository_dispatch:
types: [docs-preview-delete]
workflow_dispatch:
inputs:
repo:
description: 'Repository name (not fully-qualified, eg. `svelte` or `kit`)'
required: true
type: string
pr:
description: 'PR number'
required: true
type: string

env:
BRANCH: preview-${{ github.event.client_payload.package }}-${{ github.event.client_payload.pr }}
BRANCH: preview-${{ inputs.repo }}-${{ inputs.pr }}

jobs:
Sync:
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/sync-docs.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Sync docs

on:
repository_dispatch:
types: [sync-request]
workflow_dispatch:
inputs:
repo:
description: 'Repository name (not fully-qualified, eg. `svelte` or `kit`)'
required: true
type: string

jobs:
Sync:
Expand All @@ -17,13 +21,13 @@ jobs:
- run: pnpm install --frozen-lockfile

- name: Sync
run: cd apps/svelte.dev && pnpm sync-docs -p ${{ github.event.client_payload.package }}
run: cd apps/svelte.dev && pnpm sync-docs -p ${{ inputs.repo }}

- name: Create or update pull request
uses: peter-evans/create-pull-request@v7
with:
commit-message: sync ${{ github.event.client_payload.package }} docs
title: Sync `${{ github.event.client_payload.package }}` docs
commit-message: sync ${{ inputs.repo }} docs
title: Sync `${{ inputs.repo }}` docs
body: This is an automated pull request. See the [README](../tree/main/apps/svelte.dev/scripts/sync-docs/README.md) for more information
branch: sync-${{ github.event.client_payload.package }}
branch: sync-${{ inputs.repo }}
base: main
Loading