Skip to content

Commit cd303be

Browse files
authored
Initial commit
0 parents  commit cd303be

File tree

68 files changed

+5214
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+5214
-0
lines changed

.gitattributes

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
* text eol=lf
2+
*.bat text eol=crlf
3+
*.patch text eol=lf
4+
*.java text eol=lf
5+
*.gradle text eol=lf
6+
*.png binary
7+
*.gif binary
8+
*.exe binary
9+
*.dll binary
10+
*.jar binary
11+
*.lzma binary
12+
*.zip binary
13+
*.pyd binary
14+
*.cfg text eol=lf
15+
*.jks binary
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Bug report
2+
description: Let us know about a bug that occurs without other mods
3+
title: '<title>'
4+
labels: bug
5+
assignees: []
6+
body:
7+
- type: checkboxes
8+
attributes:
9+
label: This issue occurs when only Valkyrien Skies and addons are installed and no other mods
10+
options:
11+
- label: I have tested this issue and it occurs when no other mods are installed
12+
required: true
13+
- type: dropdown
14+
attributes:
15+
label: Minecraft Version
16+
description: What Minecraft version does this issue occur on?
17+
options:
18+
- 1.20.1
19+
validations:
20+
required: true
21+
- type: dropdown
22+
attributes:
23+
label: Mod Loader
24+
description: What mod loader does this issue occur on?
25+
options:
26+
- Forge
27+
- Fabric
28+
validations:
29+
required: true
30+
- type: textarea
31+
attributes:
32+
label: Issue description
33+
description: Describe what happens, and what you expect to happen instead
34+
validations:
35+
required: true
36+
- type: textarea
37+
attributes:
38+
label: Issue reproduction
39+
description: Describe how to reproduce your issue
40+
validations:
41+
required: true
42+
- type: textarea
43+
attributes:
44+
label: Logs
45+
description: |
46+
Go to `logs` folder and drag and drop the `latest.log` and `debug.log` file into this text field.
47+
Provide crashreport if exists.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Compatibility issue
2+
description: Let us know about a bug that occurs when another mod is installed
3+
title: '<title>'
4+
labels: compat
5+
assignees: []
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: |
10+
**Note:** do not report issues with the following mods:
11+
- Optifine
12+
- Magma Server
13+
- type: input
14+
attributes:
15+
label: Mod Name
16+
description: The name of the mod that causes the compatibility issue
17+
validations:
18+
required: true
19+
- type: checkboxes
20+
attributes:
21+
label: This issue occurs when only Valkyrien Skies, addons, and the mod I have specified are installed and no other mods
22+
options:
23+
- label: I have tested this issue and it occurs with only Valkyrien Skies, addons, and the mod I have specified
24+
- type: dropdown
25+
attributes:
26+
label: Minecraft Version
27+
description: What Minecraft version does this issue occur on?
28+
options:
29+
- 1.20.1
30+
validations:
31+
required: true
32+
- type: dropdown
33+
attributes:
34+
label: Mod Loader
35+
description: What mod loader does this issue occur on?
36+
options:
37+
- Forge
38+
- Fabric
39+
validations:
40+
required: true
41+
- type: textarea
42+
attributes:
43+
label: Issue description
44+
description: Describe what happens, and what you expect to happen instead
45+
validations:
46+
required: true
47+
- type: textarea
48+
attributes:
49+
label: Issue reproduction
50+
description: Describe how to reproduce your issue
51+
validations:
52+
required: true
53+
- type: textarea
54+
attributes:
55+
label: Logs
56+
description: |
57+
Go to `logs` folder and drag and drop the `latest.log` and `debug.log` file into this text field.
58+
Provide crashreport if exists.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Build And Test
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags-ignore:
7+
- '**'
8+
branches-ignore:
9+
- gh-pages
10+
pull_request_target:
11+
types:
12+
- opened
13+
- reopened
14+
- synchronize
15+
16+
concurrency:
17+
group: build-${{ github.head_ref || github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
check-pr:
22+
name: Query Existing PR
23+
runs-on: ubuntu-latest
24+
outputs:
25+
inpr: ${{ steps.query.outputs.inpr }}
26+
steps:
27+
- name: Query PR
28+
id: query
29+
env:
30+
GH_TOKEN: ${{ github.token }}
31+
run: |
32+
if [[ "${{ github.event_name != 'push' || github.ref_type != 'branch' }}" == true ]]; then
33+
echo "inpr=false" >> "$GITHUB_OUTPUT"
34+
exit 0
35+
fi
36+
LENGTH=$(gh api \
37+
-H "Accept: application/vnd.github+json" \
38+
-H "X-GitHub-Api-Version: 2022-11-28" \
39+
'/repos/${{ github.repository }}/pulls?state=open&head=${{ github.repository_owner }}:${{ github.ref_name }}' \
40+
--jq 'length')
41+
if [[ "$LENGTH" == 0 ]]; then
42+
echo "inpr=false" >> "$GITHUB_OUTPUT"
43+
else
44+
echo "::warning::Branch is contributing in a PR, skipping regular checks"
45+
echo "inpr=true" >> "$GITHUB_OUTPUT"
46+
fi
47+
test:
48+
name: Check & Test
49+
runs-on: ubuntu-latest
50+
needs:
51+
- check-pr
52+
if: ${{ needs.check-pr.outputs.inpr != 'true' }}
53+
steps:
54+
- name: Checkout
55+
if: ${{ github.event_name != 'pull_request_target' }}
56+
uses: actions/checkout@v4
57+
- name: Checkout Pull Request
58+
if: ${{ github.event_name == 'pull_request_target' }}
59+
uses: actions/checkout@v4
60+
with:
61+
ref: ${{ github.event.pull_request.head.ref }}
62+
repository: ${{ github.event.pull_request.head.repo.full_name }}
63+
- name: Setup JDK
64+
uses: actions/setup-java@v3
65+
with:
66+
java-version: '17'
67+
distribution: microsoft
68+
- name: Setup Gradle
69+
uses: gradle/actions/setup-gradle@v4
70+
71+
- name: Gradle Check
72+
run: ./gradlew check --no-daemon
73+
74+
build:
75+
name: Build
76+
runs-on: ubuntu-latest
77+
needs:
78+
- test
79+
steps:
80+
- name: Checkout
81+
if: ${{ github.event_name != 'pull_request_target' }}
82+
uses: actions/checkout@v4
83+
- name: Checkout Pull Request
84+
if: ${{ github.event_name == 'pull_request_target' }}
85+
uses: actions/checkout@v4
86+
with:
87+
ref: ${{ github.event.pull_request.head.ref }}
88+
repository: ${{ github.event.pull_request.head.repo.full_name }}
89+
- name: Setup JDK
90+
uses: actions/setup-java@v3
91+
with:
92+
java-version: '17'
93+
distribution: microsoft
94+
- name: Setup Gradle
95+
uses: gradle/actions/setup-gradle@v4
96+
97+
- name: LOG-METADATA-1
98+
run: |
99+
function output() {
100+
echo "output:$1=$2"
101+
}
102+
output PR_NUMBER "${{ github.event.number }}"
103+
output HEAD_SHA "${{ github.sha }}"
104+
- name: Gradle Build
105+
run: ./gradlew build --no-daemon "-Dmod_artifact_suffix=-pr${{ github.event.number }}-$(git rev-parse --short ${{ github.sha }})"
106+
- name: Upload Build Artifacts
107+
id: artifact
108+
uses: actions/upload-artifact@v4
109+
with:
110+
name: ${{ format('VSAddonTemplate Artifacts PR {0}', github.event.number) }}
111+
path: mod-output/*.jar
112+
overwrite: true
113+
if-no-files-found: error
114+
- name: LOG-METADATA-2
115+
run: |
116+
function output() {
117+
echo "output:$1=$2"
118+
}
119+
output ARTIFACT_ID "${{ steps.artifact.outputs.artifact-id }}"
120+
output ARTIFACT_URL "${{ steps.artifact.outputs.artifact-url }}"
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# https://github.com/orgs/community/discussions/51403
2+
3+
name: Comment Artifacts
4+
5+
on:
6+
workflow_run:
7+
types:
8+
- "completed"
9+
workflows:
10+
- "Build And Test"
11+
12+
permissions:
13+
actions: read
14+
attestations: read
15+
contents: read
16+
pull-requests: write
17+
18+
jobs:
19+
parse-metadata:
20+
runs-on: ubuntu-latest
21+
outputs:
22+
PR_NUMBER: ${{ steps.metadata.outputs.PR_NUMBER }}
23+
HEAD_SHA: ${{ steps.metadata.outputs.HEAD_SHA }}
24+
ARTIFACT_ID: ${{ steps.metadata.outputs.ARTIFACT_ID }}
25+
ARTIFACT_URL: ${{ steps.metadata.outputs.ARTIFACT_URL }}
26+
ARTIFACT_EXP: ${{ steps.metadata.outputs.ARTIFACT_EXP }}
27+
ARTIFACT_NAME: ${{ steps.metadata.outputs.ARTIFACT_NAME }}
28+
JAVADOC_FOLDER: ${{ steps.metadata.outputs.JAVADOC_FOLDER }}
29+
steps:
30+
- name: Get Artifact URL & PR Info
31+
id: metadata
32+
env:
33+
GITHUB_TOKEN: ${{ github.token }}
34+
OWNER: ${{ github.repository_owner }}
35+
REPO: ${{ github.event.repository.name }}
36+
WORKFLOW_RUN_EVENT_OBJ: ${{ toJSON(github.event.workflow_run) }}
37+
PREVIOUS_JOB_ID: ${{ github.event.workflow_run.id }}
38+
run: |
39+
echo "Previous Job ID: $PREVIOUS_JOB_ID"
40+
41+
LOG_URL="/repos/$OWNER/$REPO/actions/runs/$PREVIOUS_JOB_ID/logs"
42+
echo "Getting previous logs: $LOG_URL"
43+
gh api "$LOG_URL" >_logs.zip
44+
echo "Unzipping logs"
45+
unzip -p _logs.zip >_build.txt
46+
47+
echo "Parsing logs"
48+
function parse_var {
49+
name=$1
50+
echo "Parsing output $name"
51+
line=$(cat _build.txt | grep -m 1 "output:${name}=" | cat)
52+
export parsed=${line#*"output:${name}="}
53+
}
54+
parse_var PR_NUMBER
55+
PR_NUMBER=$parsed
56+
echo "PR Number: $PR_NUMBER"
57+
echo "PR_NUMBER=$PR_NUMBER" >> "$GITHUB_OUTPUT"
58+
59+
parse_var HEAD_SHA
60+
HEAD_SHA=$parsed
61+
echo "Head sha: $HEAD_SHA"
62+
echo "HEAD_SHA=$HEAD_SHA" >> "$GITHUB_OUTPUT"
63+
64+
parse_var ARTIFACT_ID
65+
ARTIFACT_ID=$parsed
66+
echo "ARTIFACT ID: $ARTIFACT_ID"
67+
echo "ARTIFACT_ID=$ARTIFACT_ID" >> "$GITHUB_OUTPUT"
68+
69+
parse_var ARTIFACT_URL
70+
ARTIFACT_URL=$parsed
71+
echo "ARTIFACT URL: $ARTIFACT_URL"
72+
echo "ARTIFACT_URL=$ARTIFACT_URL" >> "$GITHUB_OUTPUT"
73+
74+
if [[ "$ARTIFACT_ID" != "" ]]; then
75+
ARTIFACT_INFO="$(gh api "/repos/$OWNER/$REPO/actions/artifacts/$ARTIFACT_ID")"
76+
ARTIFACT_EXP=$(echo "$ARTIFACT_INFO" | jq -r ".expires_at")
77+
echo "ARTIFACT EXP: $ARTIFACT_EXP"
78+
echo "ARTIFACT_EXP=$ARTIFACT_EXP" >> "$GITHUB_OUTPUT"
79+
ARTIFACT_NAME=$(echo "$ARTIFACT_INFO" | jq -r ".name")
80+
echo "ARTIFACT NAME: $ARTIFACT_NAME"
81+
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> "$GITHUB_OUTPUT"
82+
fi
83+
84+
parse_var JAVADOC_FOLDER
85+
JAVADOC_FOLDER=$parsed
86+
echo "JAVADOC FOLDER: $JAVADOC_FOLDER"
87+
echo "JAVADOC_FOLDER=$JAVADOC_FOLDER" >> "$GITHUB_OUTPUT"
88+
89+
exit 0
90+
91+
comment-success:
92+
if: ${{ needs.parse-metadata.outputs.PR_NUMBER != '' }}
93+
runs-on: ubuntu-latest
94+
needs:
95+
- parse-metadata
96+
steps:
97+
- name: Find Comment
98+
uses: peter-evans/find-comment@v3
99+
id: fc
100+
with:
101+
issue-number: ${{ needs.parse-metadata.outputs.PR_NUMBER }}
102+
comment-author: 'github-actions[bot]'
103+
body-includes: '## Build Preview'
104+
105+
- name: Generate Comment
106+
id: generate-body
107+
env:
108+
JOB_PATH: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}"
109+
HEAD_SHA: ${{ needs.parse-metadata.outputs.HEAD_SHA }}
110+
ARTIFACT_URL: ${{ needs.parse-metadata.outputs.ARTIFACT_URL }}
111+
ARTIFACT_EXP: ${{ needs.parse-metadata.outputs.ARTIFACT_EXP }}
112+
ARTIFACT_NAME: ${{ needs.parse-metadata.outputs.ARTIFACT_NAME }}
113+
JAVADOC_FOLDER: ${{ needs.parse-metadata.outputs.JAVADOC_FOLDER }}
114+
run: |-
115+
BODY="
116+
## Build Preview
117+
118+
[![badge]](${JOB_PATH})
119+
120+
You can find files attached to the below linked Workflow Run URL (Logs).
121+
122+
| Name | Link |
123+
|-----------|-------------|
124+
| Commit | ${HEAD_SHA} |
125+
| Logs | ${JOB_PATH} |"
126+
127+
# if [ -n "$JAVADOC_FOLDER" ]; then
128+
# BODY="${BODY}
129+
# | JavaDoc | <https://jcm236.github.io/Starlance/javadoc/${JAVADOC_FOLDER}/> |"
130+
# fi
131+
132+
if [ -n "$ARTIFACT_URL" ]; then
133+
BODY="${BODY}
134+
| Jar Files | [${ARTIFACT_NAME}](${ARTIFACT_URL}) |
135+
| Expires At | ${ARTIFACT_EXP} |"
136+
fi
137+
138+
BODY="${BODY}
139+
140+
[badge]: https://img.shields.io/badge/${{ format('{0}-{1}', github.event.workflow_run.conclusion, github.event.workflow_run.conclusion == 'success' && '3fb950' || 'f85149') }}?style=for-the-badge&logo=github&label=build
141+
"
142+
143+
echo "BODY<<BODY_EOF" >> "$GITHUB_OUTPUT"
144+
echo "$BODY" >> "$GITHUB_OUTPUT"
145+
echo "BODY_EOF" >> "$GITHUB_OUTPUT"
146+
147+
- name: Update Comment
148+
uses: peter-evans/create-or-update-comment@v4
149+
with:
150+
issue-number: ${{ needs.parse-metadata.outputs.PR_NUMBER }}
151+
comment-id: ${{ steps.fc.outputs.comment-id }}
152+
edit-mode: replace
153+
body: ${{ steps.generate-body.outputs.BODY }}

0 commit comments

Comments
 (0)