Skip to content

Commit aec70a5

Browse files
committed
WIP
1 parent ee79c2d commit aec70a5

13 files changed

Lines changed: 287 additions & 5 deletions

File tree

gh/add-issue-type.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash -e
2+
3+
REPO=$1
4+
5+
function checkVar() {
6+
if [ "$1" == "" ]; then
7+
echo "usage: repository"
8+
exit 1
9+
fi
10+
}
11+
12+
checkVar "$REPO"
13+
14+
echo "Changing $OLD to $NEW in $REPO"
15+
echo "------------------"
16+
17+
for i in $(gh issue list -R "$REPO" -L 500 -S "state:open no:type" --json number,labels | jq '[.[] | { number, labels: .labels | map(.name) | [.[] | select(startswith("kind/")) ] | join(",") }]' | jq -r '.[] | [.number, .labels] | join(",")'); do
18+
ISSUE=$(echo $i | cut -d ',' -f 1)
19+
TYPE=$(echo $i | cut -d ',' -f 2 | sed 's|kind/||')
20+
21+
if [ "$TYPE" == "epic" ]; then
22+
echo "https://github.com/keycloak/keycloak/issues/$ISSUE --> $TYPE (skipping)"
23+
elif [ "$TYPE" == "" ]; then
24+
echo "https://github.com/keycloak/keycloak/issues/$ISSUE --> $TYPE (skipping)"
25+
else
26+
echo "https://github.com/keycloak/keycloak/issues/$ISSUE --> $TYPE"
27+
echo "{\"type\":\"$TYPE\"}" | gh api -X PATCH "repos/$REPO/issues/$ISSUE" --silent --input -
28+
fi
29+
30+
31+
done
32+

gh/all-issues.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

gh/all-issues.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash -e
2+
3+
gh api -X GET /repos/keycloak/keycloak/issues -F state=open --paginate > all-issues.json

gh/replace-label.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash -e
2+
3+
REPO=$1
4+
OLD=$2
5+
NEW=$3
6+
7+
function checkVar() {
8+
if [ "$1" == "" ]; then
9+
echo "usage: repository old-label new-label"
10+
exit 1
11+
fi
12+
}
13+
14+
checkVar "$REPO"
15+
checkVar "$OLD"
16+
checkVar "$NEW"
17+
18+
echo "Changing $OLD to $NEW in $REPO"
19+
echo "------------------"
20+
21+
for i in $(gh issue list -R "$REPO" -s all -l "$OLD" --json number | jq -r .[].number); do
22+
gh issue edit -R "$REPO" $i --remove-label "$OLD" --add-label "$NEW"
23+
done
24+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package io.github.stianst.gh;
2+
3+
import com.fasterxml.jackson.databind.JsonNode;
4+
import com.fasterxml.jackson.databind.ObjectMapper;
5+
6+
import java.io.File;
7+
import java.io.IOException;
8+
import java.util.Iterator;
9+
import java.util.LinkedList;
10+
import java.util.List;
11+
import java.util.Spliterator;
12+
import java.util.Spliterators;
13+
import java.util.stream.StreamSupport;
14+
15+
public class IssuesWithDuplicatedKindLabels {
16+
17+
public static void main(String[] args) throws IOException {
18+
File file = new File("gh/all-issues.json");
19+
System.out.println(file.getAbsolutePath());
20+
ObjectMapper om = new ObjectMapper();
21+
JsonNode jsonNode = om.readValue(file, JsonNode.class);
22+
23+
List<Issue> issues = new LinkedList<>();
24+
25+
Iterator<JsonNode> elements = jsonNode.elements();
26+
while (elements.hasNext()) {
27+
JsonNode next = elements.next();
28+
String url = next.get("html_url").asText();
29+
String type = !next.get("type").isNull() ? next.get("type").get("name").asText() : null;
30+
JsonNode labels = next.get("labels");
31+
List<String> labelStrings = StreamSupport.stream(Spliterators.spliteratorUnknownSize(labels.elements(), Spliterator.ORDERED), false)
32+
.map(n -> n.get("name").asText())
33+
.filter(k -> k.startsWith("kind/"))
34+
.filter(k -> !k.equals("kind/performance"))
35+
.filter(k -> !k.equals("kind/weakness"))
36+
.filter(k -> !k.equals("kind/cve"))
37+
.toList();
38+
issues.add(new Issue(url, labelStrings, type));
39+
}
40+
41+
System.out.println("Issues with multiple kind labels:");
42+
issues.stream().filter(i -> i.labels().size() > 1).forEach(i -> System.out.println(i.url() + " --> " + i.labels()));
43+
44+
/* (labelStrings.size() > 1) {
45+
// System.out.println(url + " --> " + labelStrings);
46+
} else if (type != null) {
47+
if (labelStrings.get(0).equals("kind/" + type)) {
48+
System.out.println(url + " --> " + labelStrings + " == " + type);
49+
}
50+
}*/
51+
52+
System.out.println("");
53+
System.out.println("Issues with miss-matching type and kind labels:");
54+
issues.stream().filter(i -> i.type() != null && i.labels().size() == 1 && !i.labels().get(0).equals("kind/" + i.type())).forEach(i -> System.out.println(i.url() + " --> " + i.type() + " != " + i.labels()));
55+
}
56+
57+
private record Issue(String url, List<String> labels, String type) {}
58+
59+
}

ghstars/repos

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ ory/hydra
44
goauthentik/authentik
55
supertokens/supertokens-core
66
apereo/cas
7-
apereo/cas
87
casdoor/casdoor
98
dexidp/dex
109
zitadel/zitadel

ghstars/stars-per-repo.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash -e
22

3-
for i in $(cat repos); do
4-
echo $i $(gh api -X GET /repos/$i -q .stargazers_count) | awk '{ printf "%-35s %-40s\n", $1, $2}'
5-
done
3+
{ for i in $(cat repos); do
4+
echo $i $(gh api -X GET /repos/$i -q .stargazers_count) | awk '{ printf "%-10s %-40s\n", $2, $1}'
5+
done } | sort -n -r

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
<module>kc-tools/logs</module>
2525
<module>kc-tools/basic-perf</module>
2626
<!-- <module>junit-testsuite-poc</module>-->
27-
<module>test-logs-parser</module>
27+
<!-- <module>test-logs-parser</module>-->
2828
<module>gpg-signing</module>
29+
<module>signing</module>
2930
</modules>
3031

3132
</project>

signing/pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>playground.stianst.github.io</groupId>
8+
<artifactId>signing</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.source>25</maven.compiler.source>
13+
<maven.compiler.target>25</maven.compiler.target>
14+
</properties>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>org.bouncycastle</groupId>
19+
<artifactId>bcprov-jdk18on</artifactId>
20+
<version>1.82</version>
21+
</dependency>
22+
</dependencies>
23+
24+
</project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package playground.stianst.github.io;
2+
3+
import org.bouncycastle.jce.provider.BouncyCastleProvider;
4+
5+
import java.security.Provider;
6+
import java.security.Security;
7+
8+
public class ListAvailableSignatures {
9+
10+
static void main() {
11+
Security.addProvider(new BouncyCastleProvider());
12+
for (Provider p : Security.getProviders()) {
13+
System.out.println(p.getName());
14+
for (Provider.Service s : p.getServices()) {
15+
if (s.getType().equals("Signature")) {
16+
System.out.println(" - " + s.getAlgorithm() + " " + s.getType());
17+
}
18+
}
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)