Skip to content

Commit

Permalink
Fix CI conditions again (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
WarningImHack3r authored Aug 2, 2023
1 parent 70f1f34 commit 20cda93
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 15 deletions.
46 changes: 39 additions & 7 deletions .github/workflows/pages-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,47 @@ jobs:
- name: 📥 Install NPM dependencies
run: pnpm i --no-frozen-lockfile

- name: 🔍 Detect file changes
id: detect-changes-pnpm
run: |
if [[ $(git diff --name-only) =~ pnpm-lock.yaml ]]; then
echo "changes_detected=true >> $GITHUB_OUTPUT"
else
echo "changes_detected=false >> $GITHUB_OUTPUT"
fi
- name: ❌ Exit if lock file is not updated
if: needs.permissions-check.result == 'failure' && steps.detect-changes-pnpm.outputs.changes_detected == 'true'
run: exit 1

- name: 📤 Commit updated lock file
id: auto-commit-action-lock
if: needs.permissions-check.result != 'failure'
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update lock file
file_pattern: pnpm-lock.yaml

- name: ❌ Exit if lock file has been committed
if: needs.permissions-check.result != 'failure' && steps.auto-commit-action-lock.outputs.changes_detected == 'true'
run: exit 1

- name: 🔧 Check Inlang config
run: pnpm ci:update-inlang

- name: 🔍 Detect file changes
id: detect-changes-inlang
run: |
if [[ $(git diff --name-only) =~ inlang.config.js ]]; then
echo "changes_detected=true >> $GITHUB_OUTPUT"
else
echo "changes_detected=false >> $GITHUB_OUTPUT"
fi
- name: ❌ Exit if Inlang config is not updated
if: needs.permissions-check.result == 'failure' && steps.detect-changes-inlang.outputs.changes_detected == 'true'
run: exit 1

- name: 📤 Commit updated Inlang config
id: auto-commit-action-inlang
if: needs.permissions-check.result != 'failure'
Expand All @@ -86,23 +117,23 @@ jobs:
commit_message: Update Inlang config
file_pattern: inlang.config.js

- name: ❌ Exit if changes detected
if: needs.permissions-check.result != 'failure' && steps.auto-commit-action-lock.outputs.changes_detected == 'true' || steps.auto-commit-action-inlang.outputs.changes_detected == 'true'
- name: ❌ Exit if Inlang config has been committed
if: needs.permissions-check.result != 'failure' && steps.auto-commit-action-inlang.outputs.changes_detected == 'true'
run: exit 1

- name: ✨ Check Svelte format
run: pnpm check

- name: ✨ Check style with Prettier & ESLint
id: lint-check
run: pnpm ci:lint
run: pnpm lint

- name: 🔧 Fix lint
if: failure() && needs.permissions-check.result != 'failure' && steps.lint-check.conclusion == 'failure'
if: failure() && needs.permissions-check.result != 'failure'
run: pnpm format

- name: 📤 Commit lint fixes
if: failure() && needs.permissions-check.result != 'failure' && steps.lint-check.conclusion == 'failure'
if: failure() && needs.permissions-check.result != 'failure'
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix lint
Expand Down Expand Up @@ -145,7 +176,7 @@ jobs:
run: pnpm build

- name: 📤 Upload artifact
if: github.event_name != 'pull_request'
if: github.event_name == 'push'
uses: actions/upload-pages-artifact@v2
with:
path: ./build
Expand All @@ -154,7 +185,7 @@ jobs:
name: Deploy website to GitHub Pages
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push'
if: github.event_name == 'push' && !failure() && !cancelled()
concurrency:
group: pages
cancel-in-progress: true
Expand All @@ -176,6 +207,7 @@ jobs:
name: Performance checks
runs-on: ubuntu-latest
needs: deploy
if: github.event_name == 'push' && !failure() && !cancelled()

steps:
- name: ⚓️ Unlighthouse check
Expand Down
3 changes: 3 additions & 0 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
. "$(dirname -- "$0")/_/husky.sh"

if [ "$3" == 1 ]; then # branch checkout only (not file checkout)
# install deps
pnpm deps:install
# remove local branches that have been deleted on remote
pnpx git-removed-branches -p
fi
2 changes: 1 addition & 1 deletion inlang.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export async function defineConfig(env) {
);

const { default: sdkPlugin } = await env.$import(
"https://cdn.jsdelivr.net/npm/@inlang/sdk-js-plugin@0.7.1/dist/index.js"
"https://cdn.jsdelivr.net/npm/@inlang/sdk-js-plugin@0.6.6/dist/index.js"
);

const { default: standardLintRules } = await env.$import(
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig tsconfig.json --watch",
"lint": "prettier --check . && eslint .",
"format": "prettier --write .",
"ci:lint": "prettier --check ./src && eslint ./src",
"ci:update-inlang": "node ./scripts/update-inlang-config.js",
"prepare": "husky install"
},
"devDependencies": {
"@inlang/sdk-js": "^0.7.1",
"@inlang/sdk-js": "^0.6.6",
"@inqling/svelte-icons": "^3.4.3",
"@rgossiaux/svelte-headlessui": "^2.0.0",
"@sveltejs/adapter-static": "^2.0.3",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 20cda93

Please sign in to comment.