forked from hannibal002/SkyHanni
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'beta' into dragon-calculator
- Loading branch information
Showing
851 changed files
with
29,443 additions
and
7,804 deletions.
There are no files selected for viewing
This file contains 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,13 @@ | ||
name: 'Setup Java, Gradle and check out the source code' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 21 | ||
cache: gradle | ||
- name: Setup gradle | ||
uses: gradle/actions/setup-gradle@v4 |
This file contains 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,71 @@ | ||
import {Octokit} from "@octokit/rest"; | ||
import fetch from "node-fetch"; | ||
|
||
const labelName = "Waiting on Dependency PR"; | ||
|
||
async function run() { | ||
const octokit = new Octokit({ | ||
auth: process.env.GITHUB_TOKEN, | ||
request: { | ||
fetch: fetch, | ||
}, | ||
}); | ||
|
||
const context = JSON.parse(process.env.GITHUB_CONTEXT); | ||
|
||
const pull_request = context.event.pull_request; | ||
|
||
const owner = context.repository_owner; | ||
const name = context.repository.split("/")[1]; | ||
|
||
const prNumber = pull_request.number; | ||
const prBody = pull_request.body || ""; | ||
|
||
const dependencyRegex = /## Dependencies/; | ||
const match = prBody.match(dependencyRegex); | ||
|
||
if (match) { | ||
const prLinks = prBody.match(/- https:\/\/github\.com\/[\w-]+\/[\w-]+\/pull\/\d+/g); | ||
|
||
if (prLinks && prLinks.length > 0) { | ||
let hasOpenDependencies = false; | ||
|
||
for (const link of prLinks) { | ||
const [, depOwner, depRepo, depNumber] = link.match(/github\.com\/([\w-]+)\/([\w-]+)\/pull\/(\d+)/); | ||
const {data: dependencyPr} = await octokit.pulls.get({ | ||
owner: depOwner, | ||
repo: depRepo, | ||
pull_number: depNumber, | ||
}); | ||
|
||
if (dependencyPr.state === "open") { | ||
hasOpenDependencies = true; | ||
break; | ||
} | ||
} | ||
|
||
const labels = pull_request.labels.map(label => label.name); | ||
|
||
if (hasOpenDependencies && !labels.includes(labelName)) { | ||
await octokit.issues.addLabels({ | ||
owner, | ||
repo: name, | ||
issue_number: prNumber, | ||
labels: [labelName], | ||
}); | ||
} else if (!hasOpenDependencies && labels.includes(labelName)) { | ||
await octokit.issues.removeLabel({ | ||
owner, | ||
repo: name, | ||
issue_number: prNumber, | ||
name: labelName, | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
|
||
run().catch(error => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
This file contains 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,37 @@ | ||
#!/bin/bash | ||
|
||
# This script processes the Detekt SARIF file and outputs results in a format | ||
# suitable for annotation in CI/CD systems. | ||
|
||
SARIF_FILE="$1" | ||
|
||
# Check if SARIF file exists | ||
if [ ! -f "$SARIF_FILE" ]; then | ||
echo "SARIF file not found: $SARIF_FILE" | ||
exit 1 | ||
fi | ||
|
||
# Define jq command to parse SARIF file | ||
read -r -d '' jq_command <<'EOF' | ||
.runs[].results[] | | ||
{ | ||
"full_path": .locations[].physicalLocation.artifactLocation.uri | sub("file://$(pwd)/"; ""), | ||
"file_name": (.locations[].physicalLocation.artifactLocation.uri | split("/") | last), | ||
"l": .locations[].physicalLocation, | ||
"level": .level, | ||
"message": .message.text, | ||
"ruleId": .ruleId | ||
} | | ||
( | ||
"::" + (.level) + | ||
" file=" + (.full_path) + | ||
",line=" + (.l.region.startLine|tostring) + | ||
",title=" + (.ruleId) + | ||
",col=" + (.l.region.startColumn|tostring) + | ||
",endColumn=" + (.l.region.endColumn|tostring) + | ||
"::" + (.message.text) | ||
) | ||
EOF | ||
|
||
# Run jq command to format the output | ||
jq -r "$jq_command" < "$SARIF_FILE" |
This file contains 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,64 @@ | ||
name: "Assign relevant labels" | ||
on: | ||
pull_request_target: | ||
types: [ opened, edited ] | ||
jobs: | ||
assign-label: | ||
if: github.event.pull_request.state == 'open' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
issues: write | ||
pull-requests: write | ||
contents: read | ||
steps: | ||
- name: label | ||
env: | ||
TITLE: ${{ github.event.pull_request.title }} | ||
LABEL_FIX: Bug Fix | ||
LABEL_BACKEND: Backend | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN}} | ||
script: | | ||
const labelsToAdd = []; | ||
const labelsToRemove = []; | ||
const title = process.env.TITLE.split(":")[0].toUpperCase(); | ||
if(title.includes("FIX")){ | ||
labelsToAdd.push(process.env.LABEL_FIX); | ||
} else { | ||
labelsToRemove.push(process.env.LABEL_FIX); | ||
} | ||
if(title.includes("BACKEND")){ | ||
labelsToAdd.push(process.env.LABEL_BACKEND); | ||
} else { | ||
labelsToRemove.push(process.env.LABEL_BACKEND); | ||
} | ||
for (const label of labelsToAdd) { | ||
github.rest.issues.addLabels({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: [label] | ||
}); | ||
} | ||
const {data} = await github.rest.issues.listLabelsOnIssue({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}); | ||
for (const label of labelsToRemove) { | ||
const filtered = data.filter(l => l.name == label); | ||
if(filtered.length == 1){ | ||
github.rest.issues.removeLabel({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
name: label | ||
}); | ||
} | ||
} |
This file contains 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,44 +1,70 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- "*" | ||
paths-ignore: | ||
- ".gitignore" | ||
pull_request: | ||
branches: | ||
- "*" | ||
paths-ignore: | ||
- ".gitignore" | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- "*" | ||
paths-ignore: | ||
- ".gitignore" | ||
pull_request: | ||
branches: | ||
- "*" | ||
paths-ignore: | ||
- ".gitignore" | ||
workflow_dispatch: | ||
permissions: write-all | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: "Build and test" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: temurin | ||
cache: gradle | ||
- name: Setup gradle | ||
uses: gradle/gradle-build-action@v2 | ||
- name: Build with Gradle | ||
run: ./gradlew build -x test --stacktrace | ||
- uses: actions/upload-artifact@v3 | ||
name: Upload development build | ||
with: | ||
name: "Development Build" | ||
path: build/libs/*.jar | ||
- name: Test with Gradle | ||
run: ./gradlew test | ||
- uses: actions/upload-artifact@v3 | ||
name: "Upload test report" | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: "Test Results" | ||
path: build/reports/tests/test/ | ||
build: | ||
runs-on: ubuntu-latest | ||
name: "Build and test" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup-normal-workspace | ||
- name: Build with Gradle | ||
run: ./gradlew assemble -x test --stacktrace | ||
- uses: actions/upload-artifact@v4 | ||
name: Upload development build | ||
with: | ||
name: "Development Build" | ||
path: build/libs/*.jar | ||
- name: Test with Gradle | ||
run: ./gradlew test | ||
- uses: actions/upload-artifact@v4 | ||
name: "Upload test report" | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: "Test Results" | ||
path: versions/1.8.9/build/reports/tests/test/ | ||
#detekt: | ||
# name: Run detekt | ||
# runs-on: ubuntu-latest | ||
|
||
# steps: | ||
# - name: Checkout code | ||
# uses: actions/checkout@v4 | ||
# - uses: ./.github/actions/setup-normal-workspace | ||
# # detektMain is a LOT slower than detekt, but it does type analysis | ||
# - name: Run detekt main (w/typing analysis) | ||
# run: | | ||
# ./gradlew detektMain --stacktrace | ||
# - name: Annotate detekt failures | ||
# if: ${{ !cancelled() }} | ||
# run: | | ||
# chmod +x .github/scripts/process_detekt_sarif.sh | ||
# ./.github/scripts/process_detekt_sarif.sh versions/1.8.9/build/reports/detekt/main.sarif | ||
|
||
|
||
preprocess: | ||
runs-on: ubuntu-latest | ||
name: "Build multi version" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup-normal-workspace | ||
- name: Enable preprocessor | ||
run: | | ||
mkdir -p .gradle | ||
echo skyhanni.multi-version=preprocess-only > .gradle/private.properties | ||
- name: Build with Gradle | ||
run: ./gradlew build --stacktrace |
This file was deleted.
Oops, something went wrong.
This file contains 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,27 @@ | ||
name: Check PR Dependencies | ||
|
||
# TODO: Run when other pr gets merged | ||
on: | ||
pull_request_target: | ||
types: [ opened, edited ] | ||
|
||
jobs: | ||
check-dependencies: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Install dependencies | ||
run: npm install @octokit/rest node-fetch | ||
|
||
- name: Run dependency check script | ||
run: node .github/scripts/checkDependencies.mjs | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_CONTEXT: ${{ toJson(github) }} |
This file contains 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 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
Oops, something went wrong.