Allow symlinks

This commit is contained in:
Alexandre
2025-02-18 03:43:50 +01:00
committed by GitHub
parent 107988eee3
commit a109e733a6

View File

@@ -21,6 +21,7 @@ jobs:
steps:
- name: ↩️ Checkout
uses: actions/checkout@v4
- name: Update path_filters
run: |
# Init
@@ -29,12 +30,11 @@ jobs:
# Go through all folders, add to filters if not existing
for f in $( find -- * -maxdepth 0 -type d | sort -r ); do
if [ -f "$f"/config.json ]; then
# Add to file
if ! grep "$f:" ".github/paths-filter.yml"; then
echo "$f: $f/config.*" >> ".github/paths-filter.yml"
fi
# Identify addons with true images
if [ "$(jq '.image' "$f/config.json")" != null ]; then
sed -i "/$f/ s/ # Image : yes//g" ".github/paths-filter.yml"
@@ -45,12 +45,14 @@ jobs:
# Sort yaml
sort -t= ".github/paths-filter.yml" -o ".github/paths-filter.yml"
- name: Commit if needed
uses: EndBug/add-and-commit@v9
with:
commit: -u
message: "GitHub bot : scripts executable"
default_author: github_actions
check-addon-changes:
runs-on: ubuntu-latest
needs: [correct_path_filters]
@@ -59,6 +61,7 @@ jobs:
steps:
- name: ↩️ Checkout
uses: actions/checkout@v4
- name: 📂 Detect changed files
uses: dorny/paths-filter@v3
id: filter
@@ -74,24 +77,23 @@ jobs:
if: ${{ needs.check-addon-changes.outputs.changedAddons != '[]' }}
needs: [check-addon-changes, correct-CRLF]
runs-on: ubuntu-latest
strategy:
strategy: 
fail-fast: false
matrix:
addon: ${{ fromJSON(needs.check-addon-changes.outputs.changedAddons) }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Make scripts executable
run: |
echo "Starting"
git pull origin master
git config core.filemode true
# shellcheck disable=SC2086,SC2046
#git update-index --chmod=+x $(find "$path" -type f -iname "*.sh")
chmod u+x $(find "$path" -type f -iname "*.sh") || true
#git commit -am "fixing the script permissions..."
env:
env:
path: "./${{ matrix.addon }}"
- name: Commit if needed
uses: EndBug/add-and-commit@v9
with:
@@ -109,6 +111,7 @@ jobs:
steps:
- name: ↩️ Checkout
uses: actions/checkout@v4
- name: 🔎 Run Home Assistant Add-on Lint
uses: frenck/action-addon-linter@v2
with:
@@ -129,6 +132,25 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4
# ------------------------
# Resolve symlinks step
# ------------------------
- name: Resolve Symlinks
run: |
# Find all symlinks and replace them with the real files or directories
find . -type l | while read -r link; do
target="$(readlink -f "$link")"
# Remove the symlink
rm "$link"
 
# Copy the file or directory in place
if [ -d "$target" ]; then
cp -R "$target" "$link"
else
cp "$target" "$link"
fi
done
- name: Get information
id: info
uses: home-assistant/actions/helpers/info@master
@@ -140,19 +162,15 @@ jobs:
env:
HEAD: "${{ github.head_ref }}"
run: |
# shellcheck disable=SC2157,SC2086
# shellcheck disable=SC2157,SC2086 
if [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then
# shellcheck disable=SC2129
echo "build_arch=true" >> $GITHUB_OUTPUT;
# shellcheck disable=SC2129
echo "image=$(echo ${{ steps.info.outputs.image }} | cut -d'/' -f3)" >> $GITHUB_OUTPUT;
if [[ -z "$HEAD" ]] && [[ "${{ github.event_name }}" == "push" ]]; then
# shellcheck disable=SC2129
echo "BUILD_ARGS=" >> $GITHUB_ENV;
fi
else
echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build";
# shellcheck disable=SC2129
echo "build_arch=false" >> $GITHUB_OUTPUT;
fi
@@ -192,10 +210,10 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Update changelog for minor versions
run: |
echo "Starting"
# Git pull
git pull || true
cd "$path"
# Get version
@@ -207,10 +225,13 @@ jobs:
else
exit 1
fi
# Exit if test
if [[ "$version" == *"test"* ]]; then exit 0; fi
# Create changelog
touch CHANGELOG.md
# If the version does not exist
if ! grep -q "$version" CHANGELOG.md; then
first_line="$(sed -n '/./p' CHANGELOG.md | head -n 1)"
@@ -219,9 +240,8 @@ jobs:
sed -i "1i\- Minor bugs fixed" CHANGELOG.md
fi
sed -i "1i\## $version ($(date '+%d-%m-%Y'))" CHANGELOG.md
#fi
fi
env:
env:
path: "./${{ matrix.addon }}"
- name: Commit if needed
uses: EndBug/add-and-commit@v9