Skip to content

Commit

Permalink
フォーマッタをDeployへ統合
Browse files Browse the repository at this point in the history
  • Loading branch information
nkte8 committed Apr 15, 2024
1 parent 8adbe14 commit 195deab
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/app-manual-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,19 @@ on:

jobs:
get_env_name:
name: Pre task
name: PreTask
uses: ./.github/workflows/get-environment-from-branch.yaml

auto_format:
name: PreTask
uses: ./.github/workflows/format-at-astro.yaml
permissions:
actions: write
checks: write
contents: write

deploy:
needs: ["get_env_name"]
needs: ["get_env_name", "auto_format"]
environment:
name: ${{ needs.get_env_name.outputs.env_name }}
url: ${{ steps.published.outputs.pageurl }}
Expand All @@ -35,7 +43,10 @@ jobs:

- name: Build
shell: bash
run: node --version; npm install && npm run build
run: |
echo "Commit: $(git show --format='%H' --no-patch)"
echo "Node Version: $(node --version)"
npm install && npm run build
working-directory: ./astro
env:
PUBLIC_CREATEPAGES_ENDPOINT: ${{ secrets.PUBLIC_CREATEPAGES_ENDPOINT }}
Expand Down Expand Up @@ -72,7 +83,7 @@ jobs:
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
context: 'Cloudflare Pages',
context: 'App Build & Deploy',
description: 'Deploy to Cloudflare Pages: Click Details to see build result',
state: 'success',
sha,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
name: Auto-format PR commit code at ./astro
name: Format code at ./astro

on:
pull_request:
types: ["opened", "synchronize", "reopened"]
push:
branches:
- main
workflow_call: {}

permissions:
actions: write
checks: write
contents: write

jobs:
auto-format:
auto_format:
name: Format code at ./astro
runs-on: ubuntu-latest
steps:
## PRのブランチをcheckout
- name: Checkout branch
uses: actions/checkout@v4
with:
fetch-depth: 2
ref: ${{ github.head_ref }}

- name: Run Prettier at ./astro
id: format
shell: bash
Expand All @@ -36,6 +33,10 @@ jobs:
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m "[Github Action] Auto PR Format"
git push
if (git diff --shortstat | grep '[0-9]'); then
git add .
git commit -m "[Github Action] Auto PR Format"
git push
else
echo "no difference found."
fi

0 comments on commit 195deab

Please sign in to comment.