Skip to content
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
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
* @a5chin

.github/
pyproject.toml
uv.lock
25 changes: 25 additions & 0 deletions .github/protection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"main": {
"allow_deletions": false,
"allow_force_pushes": false,
"enforce_admins": false,
"required_pull_request_reviews": {
"dismiss_stale_reviews": false,
"require_code_owner_reviews": false,
"required_approving_review_count": 1
},
"required_status_checks": {
"contexts": [],
"strict": true
},
"restrictions": null
},
"gh-pages": {
"allow_deletions": false,
"allow_force_pushes": true,
"enforce_admins": false,
"required_pull_request_reviews": null,
"required_status_checks": null,
"restrictions": null
}
}
18 changes: 18 additions & 0 deletions .github/workflows/approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Approver

on:
pull_request:
types:
- opened

jobs:
approve:
runs-on: ubuntu-latest

if: endsWith(github.actor, '[bot]')

steps:
- name: Approve
run: gh pr review ${{ github.event.number }} --approve
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/gh-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- "mkdocs.yml"
- "pyproject.toml"
- "uv.lock"
workflow_dispatch:

permissions:
contents: write
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/setting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Repository Settings

on:
pull_request:
paths:
- .github/workflows/setting.yml
- .github/protection.json
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
delete-branch:
runs-on: ubuntu-latest

steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_KEY }}

- name: Enable auto-delete head branches
run: |
gh repo edit ${{ github.repository }} --delete-branch-on-merge
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}

pages:
runs-on: ubuntu-latest

steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_KEY }}

- name: Set GitHub Pages Source
run: |
gh api -X POST "repos/${{ github.repository }}/pages" \
-f "source[branch]=${{ env.BRANCH }}" \
-f "source[path]=${{ env.TARGET_PATH }}" --silent \
|| \
gh api -X PUT "repos/${{ github.repository }}/pages" \
-f "source[branch]=${{ env.BRANCH }}" \
-f "source[path]=${{ env.TARGET_PATH }}"
env:
BRANCH: gh-pages
TARGET_PATH: /
GH_TOKEN: ${{ steps.generate-token.outputs.token }}

protection:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_KEY }}

- name: Apply Branch Protection Rules
run: |
if [ ! -f "$CONFIG_FILE" ]; then
echo "Error: $CONFIG_FILE not found!"
exit 1
fi

BRANCHES=$(jq -r 'keys[]' "$CONFIG_FILE")

for BRANCH in $BRANCHES; do
if ! gh api "repos/${{ github.repository }}/branches/$BRANCH" --silent >/dev/null 2>&1; then
echo "Warning: Branch '$BRANCH' does not exist in this repository. Skipping..."
continue
fi

jq -c ".\"$BRANCH\"" "$CONFIG_FILE" | gh api -X PUT "repos/${{ github.repository }}/branches/$BRANCH/protection" --input -
done
env:
CONFIG_FILE: .github/protection.json
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
9 changes: 9 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,17 @@ jobs:
contents: read

steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_KEY }}

- name: Checkout
uses: actions/checkout@v6
with:
token: ${{ steps.generate-token.outputs.token }}

- name: Setup Python with uv
uses: ./.github/actions/setup-python-with-uv
Expand Down
1 change: 1 addition & 0 deletions .sqlfluffignore
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,4 @@ cython_debug/
# dbt
dbt_packages/
logs/
target/
Loading