Skip to content

Commit

Permalink
Chore/patch 1 (#241)
Browse files Browse the repository at this point in the history
* update yarn and husky hooks

---------

Signed-off-by: Peter Macdonald <[email protected]>
  • Loading branch information
Parsifal-M authored Nov 6, 2024
1 parent bc7f34d commit c514815
Show file tree
Hide file tree
Showing 14 changed files with 13,276 additions and 13,134 deletions.
41 changes: 19 additions & 22 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
<!--
Before submitting your pull request, please ensure you've done the following:
- [ ] Reviewed the guidelines for contributing to this repository.
- [ ] Checked for duplicate pull requests that might already be open.
- [ ] Used clear, concise and meaningful commit messages.
- [ ] Updated any relevant documentation.
-->
# 👋 Thanks for contributing

## What type of PR is this?
## What's this PR about?

Please check the category that applies:
<!-- Please give us a brief description of what you're working on -->

- [ ] Feature
- [ ] Bug Fix
- [ ] Refactor
- [ ] Documentation Update
### Type of change

## Description
- [ ] 🌟 New feature
- [ ] 🐛 Bug fix
- [ ] 📝 Documentation update
- [ ] 🧹 Code cleanup/refactor

Please provide a brief summary of your changes and the problem they solve.
### What does it solve?

## Related Issues
<!-- Help us understand the "before" and "after" -->

If applicable, please link any related issues. Use "Closes" keyword to automatically close the issue on PR merge.
### Testing

Closes #<issue_number>
- [ ] Added/updated tests
- [ ] Need help with testing
- [ ] N/A - documentation only

## Testing
### Related issues

- [ ] I have included or updated unit tests for my changes.
- [ ] I would like some help writing tests.
- [ ] These changes do not require tests.
<!-- Example: Closes #123 -->

---
Need any help? Feel free to ask questions in your PR! 💬
16 changes: 4 additions & 12 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint, Test, and Format Workflow
name: Lint and Format

on:
workflow_dispatch:
Expand All @@ -7,8 +7,8 @@ on:
- main

jobs:
build:
name: Run on Node 18
lint:
name: Lint and Format
runs-on: ubuntu-latest

steps:
Expand All @@ -34,15 +34,7 @@ jobs:
- name: Install Dependencies
run: yarn install --immutable

- name: Run Tests
run: yarn test:all --coverage

- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Lint and Check Formatting
run: |
yarn lint:all
yarn prettier:check
yarn prettier:check
36 changes: 36 additions & 0 deletions .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Mark Stale PRs

on:
schedule:
- cron: '0 0 * * *' # Run daily at midnight
workflow_dispatch: # Allow manual trigger

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
days-before-pr-stale: 30
days-before-pr-close: 14
stale-pr-message: >
👋 Hello there! We noticed this PR hasn't had any activity in the last 30 days.
We love contributions and want to keep our PR queue healthy! If you're still interested in this PR:
- Add a comment
- Push a commit
- Update the description
No action needed if you'd like it to be closed automatically in 14 days. Thanks for contributing! ✨
close-pr-message: >
Hi again! Since there hasn't been any activity in the last 44 days, we're gently closing this PR.
Don't worry though - feel free to reopen it anytime if you'd like to continue working on it!
We appreciate your contribution and are here to help if you need anything. 🙌
stale-pr-label: 'stale'
exempt-pr-labels: 'ready,work-in-progress,blocked'

repo-token: ${{ secrets.GITHUB_TOKEN }}
operations-per-run: 100
ascending: true
remove-stale-when-updated: true
46 changes: 46 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Run Tests

on:
workflow_dispatch:
pull_request:
branches:
- main

jobs:
test:
name: Test on Node 18
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.x'

- name: Clean Yarn Cache
run: yarn cache clean

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.cache/yarn
key: yarn-${{ runner.OS }}-18-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-${{ runner.OS }}-18-
- name: Install Dependencies
run: yarn install --immutable

- name: TypeScript Type Check
run: yarn tsc:full

- name: Run Tests
run: yarn test:all --coverage

- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/welcome.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Welcome

on:
pull_request_target:
types: [opened]
issues:
types: [opened]

jobs:
welcome:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "👋 Thanks for opening your first issue! Someone will review it soon."
pr-message: "🎉 Thanks for your first PR! We'll review it as soon as possible."
26 changes: 23 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
echo "🔍 Checking pre-commit requirements..."

npx lint-staged
echo "🧹 Running lint-staged checks..."
# Run lint-staged and store exit code
yarn lint-staged
LINT_RESULT=$?

# Prettier Check
echo "🧹 Running prettier checks..."
yarn prettier:check
PRETTIER_RESULT=$?

# Run tests
echo "🧪 Running tests..."
yarn test:changed
TEST_RESULT=$?

# Exit with error if either check failed
if [ $LINT_RESULT -ne 0 ] || [ $TEST_RESULT -ne 0 ] || [ $PRETTIER_RESULT -ne 0 ]; then
echo "❌ Pre-commit checks failed"
exit 1
fi

echo "✅ Pre-commit checks passed"
28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.4.cjs

This file was deleted.

934 changes: 934 additions & 0 deletions .yarn/releases/yarn-4.5.1.cjs

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
httpTimeout: 300000
compressionLevel: mixed

nodeLinker: node-modules
enableGlobalCache: true

npmRegistryServer: 'https://registry.npmjs.org/'
httpTimeout: 300000

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.6.4.cjs
npmRegistryServer: "https://registry.npmjs.org/"

enableGlobalCache: true
yarnPath: .yarn/releases/yarn-4.5.1.cjs
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"clean": "backstage-cli repo clean",
"test": "backstage-cli repo test",
"test:all": "backstage-cli repo test --coverage",
"test:changed": "backstage-cli repo test --onlyChanged --coverage",
"lint": "backstage-cli repo lint --since origin/main",
"lint:all": "backstage-cli repo lint",
"prettier:write": "prettier --write .",
Expand All @@ -37,6 +38,7 @@
"@spotify/eslint-plugin": "^14.1.3",
"@spotify/prettier-config": "^15.0.0",
"concurrently": "^8.0.0",
"eslint": "^8.6.0",
"eslint-plugin-jest": "*",
"eslint-plugin-notice": "^0.9.10",
"eslint-plugin-react": "^7.28.0",
Expand All @@ -56,11 +58,7 @@
"prettier": "@spotify/prettier-config",
"lint-staged": {
"*.{js,jsx,ts,tsx,mjs,cjs}": [
"eslint --fix",
"prettier:check"
],
"*.{json,md,yaml}": [
"prettier:check"
"eslint --fix ."
]
},
"jest": {
Expand All @@ -75,5 +73,5 @@
"plugins/opa-backend-demo"
]
},
"packageManager": "yarn@3.6.4"
"packageManager": "yarn@4.5.1"
}
10 changes: 10 additions & 0 deletions packages/opa-authz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
"backstage": {
"role": "node-library"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Parsifal-M/backstage-opa-plugins.git"
},
"keywords": [
"backstage",
"OPA",
"Open Policy Agent",
"plugin"
],
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import {
BackstageCredentials,
BackstageUserPrincipal,
} from '@backstage/backend-plugin-api';

export interface TodoItem {
title: string;
id: string;
Expand Down
Loading

0 comments on commit c514815

Please sign in to comment.