Skip to content

fix workflows

fix workflows #7

Workflow file for this run

name: Update LuaLS Addon
on:
push:
tags:
- 'release/**'
workflow_dispatch:
inputs:
version:
description: 'Version tag (e.g., v1.5.0-2026.04.30)'
required: true
type: string
permissions:
contents: write
jobs:
update-addon:
runs-on: ubuntu-latest
steps:
- name: Resolve version
run: |
if [ "${{ github.event_name }}" = "push" ]; then
VERSION="${GITHUB_REF_NAME#release/}"
else
VERSION=${{ github.event.inputs.version }}
fi
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
- name: Checkout main source
uses: actions/checkout@v4
with:
ref: main
- name: Save ethos.lua temporally
run: |
mkdir -p /tmp/ethos-addon
cp library/ethos.lua /tmp/ethos-addon/
- name: Checkout luals-addon branch
uses: actions/checkout@v4
with:
ref: luals-addon
clean: true
- name: Update ethos.lua in luals-addon branch
run: |
mkdir -p library
cp /tmp/ethos-addon/ethos.lua library/ethos.lua
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add library/ethos.lua
if git diff-index --quiet HEAD; then
echo "No changes to commit."
else
git commit -m "Update ethos.lua to $VERSION"
git tag "$VERSION"
git push origin luals-addon --tags
fi
- name: Checkout LLS-Addons fork
uses: actions/checkout@v4
with:
repository: flyingeek/LLS-Addons
token: ${{ secrets.ADDON_PAT }}
path: LLS-Addons
submodules: false
- name: Sync fork with upstream
run: gh repo sync flyingeek/LLS-Addons --source LuaLS/LLS-Addons --branch main
env:
GITHUB_TOKEN: ${{ secrets.ADDON_PAT }}
- name: Update submodule and Create PR
working-directory: LLS-Addons
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Replace invalid branch chars safely
CLEAN_VERSION=$(echo "$VERSION" | tr -cd '[:alnum:].-')
BRANCH_NAME="update-ethos-addon-${CLEAN_VERSION}"
git checkout -B $BRANCH_NAME
# Init only the ethos submodule (avoid broken submodules from other addons)
git submodule update --init addons/ethos/module
# Update the submodule to point to the newest commit on luals-addon branch
git submodule update --remote addons/ethos/module
git add addons/ethos/module
if git diff-index --quiet HEAD; then
echo "No changes to submodule."
else
git commit -m "Update ethos addon to $VERSION"
git push --force origin $BRANCH_NAME
echo $GITHUB_TOKEN | gh auth login --with-token
gh pr create --repo LuaLS/LLS-Addons \
--title "Update ethos addon to $VERSION" \
--body "Automated update of ETHOS Lua definitions to version $VERSION." \
--head flyingeek:$BRANCH_NAME \
--base main
fi
env:
GITHUB_TOKEN: ${{ secrets.ADDON_PAT }}