-
Notifications
You must be signed in to change notification settings - Fork 69
Add setting workflow #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add setting workflow #168
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
ea6d0c6
add: setting workflow
a5chin 96d00d8
test
a5chin 8cbc1f8
test
a5chin 855c0b1
fix: GH_TOKEN
a5chin ab0f616
fix: GH_TOKEN
a5chin 9b2ba47
test
a5chin 99cb298
test
a5chin 8eaec35
test
a5chin a6502f1
test
a5chin 5be0858
test
a5chin 80139a9
fix: path
a5chin 3e24c56
fix: name
a5chin 85f7e0b
fix: required_status_checks
a5chin dd0a718
Update .github/workflows/setting.yml
a5chin c668efa
fix: protection
a5chin a509d44
fix: protection
a5chin 4522b62
fix: protection
a5chin b72a8b5
fix: sqlfluffignore
a5chin 09e5f4a
fix: protection
a5chin c2ea24e
fix: coverage
a5chin f52ff96
add: approver
a5chin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| * @a5chin | ||
|
|
||
| .github/ | ||
| pyproject.toml | ||
| uv.lock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ on: | |
| - "mkdocs.yml" | ||
| - "pyproject.toml" | ||
| - "uv.lock" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,3 +194,4 @@ cython_debug/ | |
| # dbt | ||
| dbt_packages/ | ||
| logs/ | ||
| target/ | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.