diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..bde58cc --- /dev/null +++ b/.drone.yml @@ -0,0 +1,72 @@ +--- +kind: pipeline +name: test + +platform: + os: linux + arch: amd64 + +concurrency: + limit: 1 + +steps: + - name: markdownlint + image: quay.io/thegeeklab/markdownlint-cli + commands: + - markdownlint 'README.md' + + - name: spellcheck + image: quay.io/thegeeklab/alpine-tools + commands: + - spellchecker --files 'README.md' -d .dictionary -p spell indefinite-article syntax-urls + environment: + FORCE_COLOR: true + NPM_CONFIG_LOGLEVEL: error + + - name: lint + image: docker.io/koalaman/shellcheck-alpine:stable + commands: + - grep -ErlI '^#!(.*/|.*env +)(sh|bash|ksh)' ./shell/ | xargs -r shellcheck + +trigger: + ref: + - refs/heads/main + - refs/tags/** + - refs/pull/** + +--- +kind: pipeline +name: notifications + +platform: + os: linux + arch: amd64 + +steps: + - name: matrix + image: quay.io/thegeeklab/drone-matrix + settings: + homeserver: + from_secret: matrix_homeserver + password: + from_secret: matrix_password + roomid: + from_secret: matrix_roomid + template: "Status: **{{ .Build.Status }}**
Build: [{{ .Repo.Owner }}/{{ .Repo.Name }}]({{ .Build.Link }}){{ if .Build.Branch }} ({{ .Build.Branch }}){{ end }} by {{ .Commit.Author }}
Message: {{ .Commit.Message.Title }}" + username: + from_secret: matrix_username + when: + status: + - success + - failure + +trigger: + ref: + - refs/heads/main + - refs/tags/** + status: + - success + - failure + +depends_on: + - build diff --git a/.github/settings.yml b/.github/settings.yml deleted file mode 100644 index b74ec0b..0000000 --- a/.github/settings.yml +++ /dev/null @@ -1,55 +0,0 @@ -repository: - name: helpers - topics: cli, tools, shell, cheatsheet - - private: false - has_issues: true - has_wiki: false - has_downloads: true - - default_branch: main - - allow_squash_merge: true - allow_merge_commit: true - allow_rebase_merge: true - -labels: - - name: bug - color: d73a4a - description: Something isn't working - - name: documentation - color: 0075ca - description: Improvements or additions to documentation - - name: duplicate - color: cfd3d7 - description: This issue or pull request already exists - - name: enhancement - color: a2eeef - description: New feature or request - - name: good first issue - color: 7057ff - description: Good for newcomers - - name: help wanted - color: 008672 - description: Extra attention is needed - - name: invalid - color: e4e669 - description: This doesn't seem right - - name: question - color: d876e3 - description: Further information is requested - - name: wontfix - color: ffffff - description: This will not be worked on - -branches: - - name: main - protection: - required_pull_request_reviews: null - required_status_checks: - strict: false - contexts: - - ci/woodpecker/pr/test - enforce_admins: false - required_linear_history: true - restrictions: null diff --git a/.woodpecker/notify.yml b/.woodpecker/notify.yml deleted file mode 100644 index 4f6776d..0000000 --- a/.woodpecker/notify.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -when: - - event: [tag] - - event: [push, manual] - branch: - - ${CI_REPO_DEFAULT_BRANCH} - -runs_on: [success, failure] - -steps: - matrix: - image: quay.io/thegeeklab/wp-matrix - settings: - homeserver: - from_secret: matrix_homeserver - password: - from_secret: matrix_password - roomid: - from_secret: matrix_roomid - username: - from_secret: matrix_username - when: - - status: [success, failure] - -depends_on: - - test diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml deleted file mode 100644 index 1949fb3..0000000 --- a/.woodpecker/test.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -when: - - event: [pull_request, tag] - - event: [push, manual] - branch: - - ${CI_REPO_DEFAULT_BRANCH} - -steps: - lint: - group: test - image: docker.io/koalaman/shellcheck-alpine:stable - commands: - - grep -ErlI '^#!(.*/|.*env +)(sh|bash|ksh)' ./shell/ | xargs -r shellcheck diff --git a/shell/gitea-batchmerge.sh b/shell/gitea-batchmerge.sh new file mode 100644 index 0000000..c947c43 --- /dev/null +++ b/shell/gitea-batchmerge.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +## requirements: httpie + +set -eo pipefail + +GITEA_SERVER=https://gitea.example.com +GITEA_TOKEN=my-private-token +GITEA_USER="gitea" +GITEA_PR_TITLE= + +http "https://${GITEA_SERVER}/api/v1/user" 'Authorization:token '"${GITEA_TOKEN}"'' + +for repo in $(http -b "https://${GITEA_SERVER}/api/v1/users/${GITEA_USER}/repos" 'Authorization:token '"${GITEA_TOKEN}"'' | jq -r '.[] | .full_name'); do + for pr_number in $(http -b "https://${GITEA_SERVER}/api/v1/repos/${repo}/pulls" 'Authorization:token '"${GITEA_TOKEN}"'' state==open | jq -r '.[] | select(.title | contains("'"${GITEA_PR_TITLE}"'")) | .number'); do + http POST "https://${GITEA_SERVER}/api/v1/repos/${repo}/pulls/${pr_number}/merge" 'Authorization:token '"${GITEA_TOKEN}"'' do=squash + done +done