mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-03 15:44:58 +02:00
Update weekly_crlftolf.yaml
This commit is contained in:
71
.github/workflows/weekly_crlftolf.yaml
vendored
71
.github/workflows/weekly_crlftolf.yaml
vendored
@@ -1,45 +1,38 @@
|
|||||||
# yamllint disable rule:line-length
|
# yamllint disable rule:line-length
|
||||||
---
|
---
|
||||||
name: Convert crlf to lf
|
# This workflow finds and fixes CRLF endings in a repository
|
||||||
|
name: Fix CRLF Endings
|
||||||
on:
|
on: push # Trigger the workflow on push event
|
||||||
schedule:
|
|
||||||
- cron: "0 0 * * 0"
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
|
||||||
USER_AGENT: "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
fix-crlf:
|
||||||
runs-on: ubuntu-latest
|
name: Fix CRLF Endings
|
||||||
|
runs-on: ubuntu-latest # Use a Linux runner
|
||||||
permissions:
|
steps:
|
||||||
contents: write
|
- name: Checkout repository contents
|
||||||
|
uses: actions/checkout@v2 # Use the checkout action
|
||||||
steps:
|
- name: Find files with CRLF endings
|
||||||
- name: Checkout repository
|
uses: erclu/check-crlf@v1.2.0 # Use the check-crlf action
|
||||||
uses: actions/checkout@v4
|
id: check-crlf # Assign an id to this step
|
||||||
with:
|
with:
|
||||||
path: main
|
# Specify the paths to check
|
||||||
|
path: |
|
||||||
- name: Setup Env
|
./*
|
||||||
|
!.git
|
||||||
|
!*.png
|
||||||
|
!*.jpg
|
||||||
|
!*.bin
|
||||||
|
- name: Apply dos2unix to files with CRLF endings
|
||||||
run: |
|
run: |
|
||||||
sudo apt update -y
|
# Loop through each file and apply dos2unix
|
||||||
sudo apt install dos2unix -y
|
for f in ${{ steps.check-crlf.outputs.files }}; do
|
||||||
|
# Apply dos2unix and keep the original timestamp
|
||||||
- name: Dos2Unix Everything
|
dos2unix -k "$f"
|
||||||
run: |
|
done
|
||||||
#Presets
|
- name: Create a pull request with the fixed files
|
||||||
set +x ; set +e
|
uses: peter-evans/create-pull-request@v3 # Use the create-pull-request action
|
||||||
#--------------#
|
|
||||||
cd "$GITHUB_WORKSPACE/main"
|
|
||||||
find . -type f ! -path "./.git/*" -exec dos2unix {} \; 2>/dev/null
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
|
||||||
with:
|
with:
|
||||||
repository: ./main
|
# Specify the pull request details
|
||||||
commit_message: "✅ Dos2Unix-fied 🐧🖳 Everything "
|
title: Fix CRLF Endings
|
||||||
#push_options: '--force'
|
commit-message: Apply dos2unix to files with CRLF endings
|
||||||
|
branch: fix-crlf-endings
|
||||||
|
delete-branch: true
|
||||||
|
|||||||
Reference in New Issue
Block a user