Skip to content

Fetch Addon Metadata #4

Fetch Addon Metadata

Fetch Addon Metadata #4

Workflow file for this run

name: Fetch Addon Metadata
on:
pull_request_review:
types: [submitted]
workflow_dispatch:
jobs:
metadata:
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request_review' && github.event.review.state == 'approved')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
name: Checkout LLS-Addons
with:
submodules: false
- name: Fetch Base Branch
run: |
# Fetch all history for the base branch and PR head
git fetch origin ${{ github.base_ref }} --depth=1
git fetch origin ${{ github.head_ref }} --depth=1
- name: Detect Added Submodules
run: |
ADDED_SUBMODULES=$(git diff --submodule main | grep '^Submodule' | awk '{ print $2 }')
echo "Added submodules: $ADDED_SUBMODULES"
echo "ADDED_SUBMODULES=$ADDED_SUBMODULES" >> $GITHUB_ENV
- name: Fetch submodules
run: |
for submodule in $ADDED_SUBMODULES; do
echo "Getting submodule: $submodule"
git submodule update --init --recursive $submodule
done
# Custom action that gets metadata on each addon
- uses: dsaltares/[email protected]
name: Get submodule metadata fetching action
with:
token: ${{ secrets.GITHUB_TOKEN }}
repo: LuaLS/LLS-Addons-Action
file: dist.zip
target: action.zip
- name: Unzip custom action
run: unzip action.zip -d action
- uses: ./action/dist
name: Get Addon Metadata
# Commit new metadata
- name: Commit Metadata
uses: stefanzweifel/[email protected]
with:
commit_message: "chore: Update Addon Metadata"
file_pattern: addons/*/info.json
commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
commit_user_name: github-actions[bot]
commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com