Skip to content

Update syntax to Svelte 5 #103

Update syntax to Svelte 5

Update syntax to Svelte 5 #103

name: Format PR
on:
issue_comment:
types: [created]
jobs:
format:
name: Format Code
if: |
github.event.issue.pull_request &&
contains(github.event.comment.body, '/format') &&
(github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'COLLABORATOR')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Acknowledge command
uses: actions/github-script@v9
with:
script: |
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: 'eyes'
});
- name: Get PR details
uses: actions/github-script@v9
id: get-pr
with:
script: |
const prNumber = context.issue.number;
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber
});
core.setOutput('branch', pr.head.ref);
core.setOutput('sha', pr.head.sha);
core.setOutput('repo', pr.head.repo.full_name);
- name: Checkout PR branch
uses: actions/checkout@v6
with:
repository: ${{ steps.get-pr.outputs.repo }}
ref: ${{ steps.get-pr.outputs.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: pnpm/action-setup@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run format
run: pnpm format .
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: 'style: format code with prettier'
branch: ${{ steps.get-pr.outputs.branch }}
- name: React to comment
uses: actions/github-script@v9
with:
script: |
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: 'rocket'
});