Somewhat releasable version.
Some checks are pending
publish / publish (push) Waiting to run

This commit is contained in:
Jinks 2024-12-07 00:05:57 +01:00
parent ca56fcc671
commit b103bcba03
11 changed files with 311 additions and 16 deletions

View file

@ -0,0 +1,47 @@
# Do not edit this file directly
# This file is synced by https://github.com/ChaoticTrials/ModMeta
name: Check NeoForge compatibility
on:
workflow_dispatch:
schedule:
- cron: '0 3 * * 5'
jobs:
check:
runs-on: ubuntu-latest
permissions:
issues: write
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Extract Minecraft Version
id: extract-minecraft-version
run: |
minecraft_version=$(grep -m 1 "^minecraft_version=" gradle.properties | cut -d'=' -f2)
echo "minecraft_version=$minecraft_version" >> $GITHUB_ENV
- name: Get latest NeoForge
id: get-version
uses: ChaoticTrials/action-latest-forge@v1
with:
minecraft-version: ${{ env.minecraft_version }}
- name: Check compiling
uses: ChaoticTrials/action-test-different-property@v1
with:
gradle-property: neo_version
gradle-value: ${{ steps.get-version.outputs.version }}
properties-file: gradle.properties
issue-title: "[${{ env.minecraft_version }}] NeoForge incompatibility"
issue-comment: |
## NeoForge version
- ${{ steps.get-version.outputs.version }}
issue-labels: Compat, bug

View file

@ -0,0 +1,88 @@
# Do not edit this file directly
# This file is synced by https://github.com/ChaoticTrials/ModMeta
# This workflow was generated with the help of OpenAI's GPT.
name: Check Localization Files
on:
pull_request_target:
paths:
- 'src/main/resources/assets/**/lang/*.json'
permissions:
pull-requests: write
contents: read
jobs:
check-localization:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
- name: Debug PR context
run: |
echo "Pull request number: ${{ github.event.pull_request.number }}"
echo "Repository full name: ${{ github.repository }}"
echo "Event path: $GITHUB_EVENT_PATH"
- name: Check localization files
run: |
PR_NUMBER="${{ github.event.pull_request.number }}"
REPO_FULL_NAME="${{ github.repository }}"
# Ensure GitHub CLI is authenticated and correctly identifies the PR context
echo "Processing PR #$PR_NUMBER for repository $REPO_FULL_NAME"
# Get the list of added or modified localization files
FILES=$(gh pr diff "$PR_NUMBER" --repo "$REPO_FULL_NAME" --name-only | grep -E 'src/main/resources/assets/.*/lang/.*\.json' || true)
if [[ -z "$FILES" ]]; then
echo "No localization files have been modified."
exit 0
fi
# Initialize an array to store the missing keys
MISSING_KEYS=()
# Iterate over each file
for FILE in $FILES; do
# Check if the file is not the default English translation
if [[ $FILE != *"en_us.json" ]]; then
# Get the modid and language key from the file path
MODID=$(echo $FILE | cut -d'/' -f5)
LANGUAGE_KEY=$(echo $FILE | cut -d'/' -f7 | cut -d'.' -f1)
# Check if all keys from the default English translation are included in this file
KEYS=$(jq -n --argfile en src/main/resources/assets/$MODID/lang/en_us.json --argfile current $FILE '($en | keys) - ($current | keys)' )
if [[ $KEYS != "[]" ]]; then
MISSING_KEYS+=("$LANGUAGE_KEY: $KEYS")
fi
fi
done
# Post a comment on the pull request with the missing keys or a success message
if [[ ${#MISSING_KEYS[@]} -gt 0 ]]; then
echo "# 🚨 Missing translation keys 🚨" > review.md
for MISSING_KEY in "${MISSING_KEYS[@]}"; do
LANGUAGE=$(echo $MISSING_KEY | cut -d':' -f1)
KEYS=$(echo $MISSING_KEY | cut -d':' -f2 | jq -r '.[]')
echo "## **$LANGUAGE**" >> review.md
for KEY in $KEYS; do
echo "- $KEY" >> review.md
done
echo "" >> review.md
done
# Request changes on the pull request
gh pr review "$PR_NUMBER" --repo "$REPO_FULL_NAME" --request-changes --body-file review.md
else
echo "## ✅ All localization files have been checked and are complete! ✅" > review.md
echo "Waiting for approval by @MelanX" >> review.md
# Approve the pull request
gh pr review "$PR_NUMBER" --repo "$REPO_FULL_NAME" --comment --body-file review.md
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

63
.github/workflows/publish.yml vendored Normal file
View file

@ -0,0 +1,63 @@
# Do not edit this file directly
# This file is synced by https://github.com/ChaoticTrials/ModMeta
name: publish
on:
push:
branches:
- '**'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Determine previous commit
id: determine_previous_commit
run: |
if [ "${{ github.event.before }}" = "0000000000000000000000000000000000000000" ]; then
gitPrevHash=$(git rev-parse HEAD~1)
else
gitPrevHash=${{ github.event.before }}
fi
echo "GIT_PREVIOUS_COMMIT=$gitPrevHash" >> $GITHUB_ENV
- name: Check commit messages
id: check_commit_messages
run: |
commits=$(git log $GIT_PREVIOUS_COMMIT..${{ github.sha }} --pretty=format:'%s')
echo "Commits since last push:"
echo "$commits"
total_commits=$(echo "$commits" | wc -l)
meta_commits=$(echo "$commits" | grep -E '^\[meta\]' | wc -l)
if [ "$total_commits" -eq "$meta_commits" ]; then
echo "Only meta commits present, skip publishing"
echo "run_publish=false" >> $GITHUB_ENV
else
echo "run_publish=true" >> $GITHUB_ENV
fi
- name: Build and publish to maven
if: env.run_publish == 'true'
run: |
chmod +x gradlew
./gradlew clean build publish curseforge modrinth --no-configuration-cache
env:
GIT_COMMIT: ${{ github.sha }}
GIT_PREVIOUS_COMMIT: ${{ github.event.before }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

22
.github/workflows/stale.yml vendored Normal file
View file

@ -0,0 +1,22 @@
# Do not edit this file directly
# This file is synced by https://github.com/ChaoticTrials/ModMeta
name: Close stale issues and PRs
on:
schedule:
- cron: '0 */6 * * *'
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/stale@v9
with:
stale-issue-message: The required information were not provided yet. Thus, this was marked as stale.
close-issue-message: None of the required information was ever provided. If this is still an issue, feel free to reopen with the required information, or create a new issue.
only-labels: needs more info
days-before-stale: 7
days-before-close: 3