diff --git a/.github/workflows/auto-merge.yaml b/.github/workflows/auto-merge.yaml new file mode 100644 index 0000000..9a3a1bc --- /dev/null +++ b/.github/workflows/auto-merge.yaml @@ -0,0 +1,18 @@ +name: Auto-Merge + +on: + pull_request: + +permissions: + contents: write + pull-requests: write + +jobs: + merge: + if: github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]' + runs-on: ubuntu-latest + steps: + - name: Enable auto-merge + run: gh pr merge ${{ github.event.pull_request.html_url }} --auto + env: + GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml new file mode 100644 index 0000000..9ff9c52 --- /dev/null +++ b/.github/workflows/check.yaml @@ -0,0 +1,45 @@ +name: Check + +on: + pull_request: + +jobs: + check: + name: Check + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Check + run: |- + function checks() { + (gh pr checks ${{ github.event.pull_request.number }} || true) | + grep --invert-match ${{ github.run_id }} + } + + function count() { + checks | + cut --fields=2 | + (grep --count "$@" || true) + } + + while true; do + count=$(count pending) + if ((count > 0)); then + echo "Waiting for $count checks to complete..." + sleep 10 + else + break + fi + done + + count=$(count fail) + if ((count > 0)); then + echo "$count checks failed" + exit 1 + else + echo "All checks passed" + exit 0 + fi + env: + GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/template.yaml b/.github/workflows/template.yaml index 128a801..94b59b6 100644 --- a/.github/workflows/template.yaml +++ b/.github/workflows/template.yaml @@ -1,10 +1,13 @@ -name: Template +name: Sync with Template Repository on: schedule: - - cron: 0 3 * * 0 + - cron: 0 0 * * 0 workflow_dispatch: +permissions: + contents: write + concurrency: group: ${{ github.workflow }} @@ -15,13 +18,7 @@ steps: - name: Checkout uses: actions/checkout@v4 - - name: Sync Repository + - name: Sync with template repository uses: liblaf/template@main - - name: Git Commit - run: |- - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add --all - if git commit --message="ci: sync with template repository"; then - git push - fi + with: + push: true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1cbeb66..b6e2430 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,7 +37,7 @@ - id: clippy - id: fmt - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v17.0.4 + rev: v17.0.5 hooks: - id: clang-format types_or: @@ -110,7 +110,7 @@ - id: poetry-lock files: pyproject.toml - repo: https://github.com/scop/pre-commit-shfmt - rev: v3.7.0-2 + rev: v3.7.0-3 hooks: - id: shfmt-src files: (\.sh|\.zsh|\.zsh-theme|envrc|zshrc)(\.tmpl)?$