Skip to content

Commit 235f1fe

Browse files
committed
ci: just get metadata always
1 parent e3d9382 commit 235f1fe

File tree

2 files changed

+62
-82
lines changed

2 files changed

+62
-82
lines changed

.github/workflows/metadata.yml

Lines changed: 0 additions & 82 deletions
This file was deleted.

.github/workflows/pull_request.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,65 @@ jobs:
4343
token: ${{ secrets.GITHUB_TOKEN }}
4444
version: latest
4545
args: --check addons
46+
47+
metadata:
48+
runs-on: ubuntu-latest
49+
permissions:
50+
contents: write
51+
steps:
52+
- uses: actions/checkout@v3
53+
name: Checkout LLS-Addons
54+
with:
55+
submodules: false
56+
57+
- name: Set Base and Head Refs
58+
run: |
59+
BASE_REF="${{ github.event.pull_request.base.sha }}"
60+
HEAD_REF="${{ github.event.pull_request.head.sha }}"
61+
HEAD_REMOTE="${{github.event.pull_request.head.repo}}"
62+
63+
echo "BASE_REF=$BASE_REF" >> $GITHUB_ENV
64+
echo "HEAD_REF=$HEAD_REF" >> $GITHUB_ENV
65+
echo "HEAD_REMOTE=$HEAD_REMOTE" >> $GITHUB_ENV
66+
67+
- name: Fetch Base Branch
68+
run: |
69+
# Fetch all history for the base branch and PR head
70+
git fetch origin ${BASE_REF}
71+
git fetch ${HEAD_REMOTE} ${HEAD_REF}
72+
73+
- name: Detect Added Submodules
74+
run: |
75+
ADDED_SUBMODULES=$(git diff --submodule ${BASE_REF}..${HEAD_REF} | grep '^Submodule' | awk '{ print $2 }')
76+
echo "Added submodules: $ADDED_SUBMODULES"
77+
echo "ADDED_SUBMODULES=$ADDED_SUBMODULES" >> $GITHUB_ENV
78+
79+
- name: Fetch submodules
80+
run: |
81+
for submodule in $ADDED_SUBMODULES; do
82+
echo "Getting submodule: $submodule"
83+
git submodule update --init --recursive $submodule
84+
done
85+
86+
# Custom action that gets metadata on each addon
87+
- uses: dsaltares/fetch-gh-release-asset@1.1.0
88+
name: Get submodule metadata fetching action
89+
with:
90+
token: ${{ secrets.GITHUB_TOKEN }}
91+
repo: LuaLS/LLS-Addons-Action
92+
file: dist.zip
93+
target: action.zip
94+
- name: Unzip custom action
95+
run: unzip action.zip -d action
96+
- uses: ./action/dist
97+
name: Get Addon Metadata
98+
99+
# Commit new metadata
100+
- name: Commit Metadata
101+
uses: stefanzweifel/git-auto-commit-action@v4.16.0
102+
with:
103+
commit_message: "chore: Update Addon Metadata"
104+
file_pattern: addons/*/info.json
105+
commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
106+
commit_user_name: github-actions[bot]
107+
commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com

0 commit comments

Comments
 (0)