1
0
forked from clan/clan-core

Merge pull request 'Change clan favicon to one without text' (#1506) from Qubasa/clan-core:Qubasa-main into main

This commit is contained in:
clan-bot 2024-05-30 20:30:02 +00:00
commit c8fbf87fc8
4 changed files with 50 additions and 21 deletions

View File

@ -96,7 +96,7 @@ site_dir: out
theme: theme:
font: false font: false
logo: https://clan.lol/static/logo/clan-white.png logo: https://clan.lol/static/logo/clan-white.png
favicon: https://clan.lol/static/logo/clan-dark.png favicon: https://clan.lol/static/dark-favicon/128x128.png
name: material name: material
features: features:
- navigation.instant - navigation.instant

26
pkgs/merge-after-ci/merge-after-ci.py Normal file → Executable file
View File

@ -1,4 +1,5 @@
import argparse import argparse
import shlex
import subprocess import subprocess
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
@ -11,14 +12,17 @@ args = parser.parse_args()
if not args.reviewers and not args.no_review: if not args.reviewers and not args.no_review:
parser.error("either --reviewers or --no-review must be given") parser.error("either --reviewers or --no-review must be given")
subprocess.run( cmd = [
[ "tea-create-pr",
"tea-create-pr", "origin",
"origin", "upstream",
"main", "main",
"--assignees", "--assignees",
",".join(["clan-bot", *args.reviewers]), ",".join(["clan-bot", *args.reviewers]),
*(["--labels", "needs-review"] if not args.no_review else []), *(["--labels", "needs-review"] if not args.no_review else []),
*args.args, *args.args,
] ]
)
print("Running:", shlex.join(cmd))
subprocess.run(cmd)

View File

@ -4,6 +4,7 @@
coreutils, coreutils,
git, git,
tea, tea,
gawk,
openssh, openssh,
}: }:
writeShellApplication { writeShellApplication {
@ -14,6 +15,7 @@ writeShellApplication {
git git
tea tea
openssh openssh
gawk
]; ];
text = builtins.readFile ./script.sh; text = builtins.readFile ./script.sh;
} }

41
pkgs/tea-create-pr/script.sh Normal file → Executable file
View File

@ -1,17 +1,39 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
remoteName="${1:-origin}" remoteFork="${1:-origin}"
targetBranch="${2:-main}" remoteUpstream="${2:-upstream}"
targetBranch="${3:-main}"
shift && shift shift && shift
TMPDIR="$(mktemp -d)" TMPDIR="$(mktemp -d)"
currentBranch="$(git rev-parse --abbrev-ref HEAD)" currentBranch="$(git rev-parse --abbrev-ref HEAD)"
user="$(tea login list -o simple | cut -d" " -f4 | head -n1)" user="$(git config --get remote.origin.url | awk -F'[@:/]' '{print $3}' | tr -d '\n')"
tempRemoteBranch="$user-$currentBranch" tempRemoteBranch="$user-$currentBranch"
root_dir=$(git rev-parse --show-toplevel)
nix fmt -- --fail-on-change # Function to check if a remote exists
check_remote() {
if git remote get-url "$1" > /dev/null 2>&1; then
return 0
else
return 1
fi
}
# Check if the remote 'upstream' is defined
if ! check_remote "$remoteUpstream"; then
echo "Error: $remoteUpstream remote is not defined."
echo "Please fork the repository and add the $remoteUpstream remote."
echo "$ git remote add $remoteUpstream <upstream-url>"
exit 1
fi
upstream_url=$(git remote get-url "$remoteUpstream")
repo=$(echo "$upstream_url" | sed -E 's#.*:([^/]+/[^.]+)\.git#\1#')
treefmt -C "$root_dir"
git log --reverse --pretty="format:%s%n%n%b%n%n" "$remoteUpstream/$targetBranch..HEAD" > "$TMPDIR"/commit-msg
git log --reverse --pretty="format:%s%n%n%b%n%n" "$remoteName/$targetBranch..HEAD" > "$TMPDIR"/commit-msg
$EDITOR "$TMPDIR"/commit-msg $EDITOR "$TMPDIR"/commit-msg
@ -23,11 +45,12 @@ rest=$(echo "$COMMIT_MSG" | tail -n+2)
if [[ "$firstLine" == "$rest" ]]; then if [[ "$firstLine" == "$rest" ]]; then
rest="" rest=""
fi fi
git push --force -u "$remoteName" HEAD:refs/heads/"$tempRemoteBranch"
git push --force -u "$remoteFork" HEAD:refs/heads/"$tempRemoteBranch"
tea pr create \ tea pr create \
--repo "$repo" \
--head "$user:$tempRemoteBranch" \
--title "$firstLine" \ --title "$firstLine" \
--description "$rest" \ --description "$rest" \
--head "$tempRemoteBranch" \ "$@"
--base "$targetBranch" \
"$@"