Update workflow to use [skip actions] flag for infinite loop prevention
- Remove conditional check based on commit message detection - Use [skip actions] flag in commit message to prevent workflow recursion - Simplify git configuration using inline -c flags instead of git config --local - Combine commit and push steps for cleaner workflow execution - Follow Gitea Actions best practices for preventing infinite loops - Maintain all functionality while using standard skip actions approach
This commit is contained in:
@@ -12,8 +12,6 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
auto-sort:
|
auto-sort:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# Skip if the commit was made by the CI bot to prevent infinite loops
|
|
||||||
if: ${{ !contains(github.event.head_commit.message, 'Auto-sort:') }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -83,19 +81,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
id: sort_files
|
id: sort_files
|
||||||
|
|
||||||
- name: Commit moved files
|
- name: Commit and push moved files
|
||||||
if: steps.sort_files.outputs.files_moved == 'true'
|
|
||||||
run: |
|
|
||||||
git config --local user.email "${{ vars.WORKER_EMAIL }}"
|
|
||||||
git config --local user.name "${{ vars.WORKER_USERNAME }}"
|
|
||||||
# git mv already stages the changes, so no need for git add
|
|
||||||
git commit -m "Auto-sort: Move DS_ and IMG_ prefixed files to correct directories
|
|
||||||
|
|
||||||
- Moved datasheet files (DS_*) to docs/datasheets/
|
|
||||||
- Moved image files (IMG_*) to docs/images/
|
|
||||||
- Automated by Gitea Actions auto-sort workflow"
|
|
||||||
|
|
||||||
- name: Push changes
|
|
||||||
if: steps.sort_files.outputs.files_moved == 'true'
|
if: steps.sort_files.outputs.files_moved == 'true'
|
||||||
run: |
|
run: |
|
||||||
# Get the repository URL dynamically
|
# Get the repository URL dynamically
|
||||||
@@ -118,6 +104,14 @@ jobs:
|
|||||||
echo "Domain: $DOMAIN"
|
echo "Domain: $DOMAIN"
|
||||||
echo "Repository Path: $REPO_PATH"
|
echo "Repository Path: $REPO_PATH"
|
||||||
echo "Worker: ${{ vars.WORKER_USERNAME }}"
|
echo "Worker: ${{ vars.WORKER_USERNAME }}"
|
||||||
|
|
||||||
|
# Commit with inline git configuration and [skip actions] flag
|
||||||
|
git -c user.name="${{ vars.WORKER_USERNAME }}" -c user.email="${{ vars.WORKER_EMAIL }}" commit -m "Auto-sort: Move DS_ and IMG_ prefixed files to correct directories [skip actions]
|
||||||
|
|
||||||
|
- Moved datasheet files (DS_*) to docs/datasheets/
|
||||||
|
- Moved image files (IMG_*) to docs/images/
|
||||||
|
- Automated by Gitea Actions auto-sort workflow"
|
||||||
|
|
||||||
echo "Pushing to: https://${DOMAIN}/${REPO_PATH} (with authentication)"
|
echo "Pushing to: https://${DOMAIN}/${REPO_PATH} (with authentication)"
|
||||||
git push $PUSH_URL HEAD:${{ github.ref_name }}
|
git push $PUSH_URL HEAD:${{ github.ref_name }}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user