Compare commits

...

35 Commits

Author SHA1 Message Date
559ccca3f8 Merge branch 'main' of https://git.b4l.co.th/B4L/b4l-project-template
All checks were successful
Auto-Sort Files / auto-sort (push) Successful in 7s
2025-08-11 13:38:25 +07:00
bb4c82c8c6 Fix workflow for Gitea Actions compatibility
- Replace GITHUB_STEP_SUMMARY with simple echo logging for Gitea compatibility
- Remove GitHub-specific step summary features that don't work in Gitea Actions
- Convert Create summary step to Log results step with console output
- Maintain debug output and step communication for troubleshooting
- Ensure workflow is fully compatible with Gitea Actions environment
2025-08-11 13:38:02 +07:00
df1aa85151 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
2025-08-11 06:34:08 +00:00
e3c125f99d test files
All checks were successful
Auto-Sort Files / auto-sort (push) Successful in 6s
2025-08-11 13:33:56 +07:00
284d715aa3 Fix workflow summary step output debugging
All checks were successful
Auto-Sort Files / auto-sort (push) Successful in 6s
- Add debug output to show the value of files_moved from previous step
- Store step output in variable for better debugging and comparison
- Fix issue where Create summary step was always showing empty results
- Ensure proper step output communication between workflow steps
- Add debugging information to troubleshoot step output issues
2025-08-11 13:32:36 +07:00
dc9c2f6c4d del old
All checks were successful
Auto-Sort Files / auto-sort (push) Successful in 6s
2025-08-11 13:30:03 +07:00
a08c3fc1fa 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
2025-08-11 06:28:33 +00:00
cad0a686c0 two test files
All checks were successful
Auto-Sort Files / auto-sort (push) Successful in 7s
2025-08-11 13:28:22 +07:00
fcb18d7fe3 Delete docs/datasheets/DS_150080RS75000.pdf
All checks were successful
Auto-Sort Files / auto-sort (push) Successful in 5s
2025-08-11 13:26:48 +07:00
8036b76f05 Delete docs/datasheets/DS_30KPA_SERIES_N0126_REV.E.pdf
Some checks failed
Auto-Sort Files / auto-sort (push) Has been cancelled
2025-08-11 13:26:43 +07:00
ee20210c7b Delete DS_150080RS75000.pdf
All checks were successful
Auto-Sort Files / auto-sort (push) Successful in 6s
2025-08-11 13:26:31 +07:00
b7b304b4fd 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
2025-08-11 06:26:03 +00:00
74a631643b extra test\
All checks were successful
Auto-Sort Files / auto-sort (push) Successful in 6s
2025-08-11 13:25:51 +07:00
7e134c7a1c test file
Some checks failed
Auto-Sort Files / auto-sort (push) Failing after 4s
2025-08-11 13:24:21 +07:00
3b5b3414fc del old files
All checks were successful
Auto-Sort Files / auto-sort (push) Successful in 4s
2025-08-11 13:16:29 +07:00
b35dd1f5d4 Update documentation for [skip actions] approach
- Update GITEA-ACTIONS-SETUP.md to document [skip actions] flag usage
- Explain infinite loop prevention using standard Gitea Actions approach
- Remove references to conditional workflow execution based on commit message detection
- Document simplified git configuration using inline -c flags
- Provide clear explanation of how [skip actions] prevents recursive workflow execution
2025-08-11 13:12:38 +07:00
928b88887d Merge branch 'main' of https://git.b4l.co.th/B4L/b4l-project-template
All checks were successful
Auto-Sort Files / auto-sort (push) Successful in 6s
2025-08-11 13:10:43 +07:00
ed728e7028 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
2025-08-11 13:10:26 +07:00
12787d8daf Auto-sort: Move DS_ and IMG_ prefixed files to correct directories
All checks were successful
Auto-Sort Files / auto-sort (push) Has been skipped
- Moved datasheet files (DS_*) to docs/datasheets/
- Moved image files (IMG_*) to docs/images/
- Automated by Gitea Actions auto-sort workflow
2025-08-11 04:58:10 +00:00
da192e0228 test ds
Some checks failed
Auto-Sort Files / auto-sort (push) Failing after 5s
2025-08-11 11:57:57 +07:00
c6c2069195 Auto-sort: Move DS_ and IMG_ prefixed files to correct directories
All checks were successful
Auto-Sort Files / auto-sort (push) Has been skipped
- Moved datasheet files (DS_*) to docs/datasheets/
- Moved image files (IMG_*) to docs/images/
- Automated by Gitea Actions auto-sort workflow
2025-08-11 04:55:45 +00:00
c685c9b519 test files
Some checks failed
Auto-Sort Files / auto-sort (push) Has been cancelled
2025-08-11 11:55:33 +07:00
c9055bbd25 Merge branch 'main' of https://git.b4l.co.th/B4L/b4l-project-template
All checks were successful
Auto-Sort Files / auto-sort (push) Successful in 4s
2025-08-11 11:52:25 +07:00
e8c01c8747 Prevent infinite workflow loops by skipping CI bot commits
- Add condition to skip workflow when triggered by Auto-sort commits
- Use github.event.head_commit.message to detect CI bot commits
- Prevent infinite loop where workflow push triggers another workflow run
- Only run workflow for user commits, not automated CI commits
- Maintains functionality while preventing recursive execution
2025-08-11 11:52:04 +07:00
edcb1adef0 Auto-sort: Move DS_ and IMG_ prefixed files to correct directories
All checks were successful
Auto-Sort Files / auto-sort (push) Successful in 4s
- Moved datasheet files (DS_*) to docs/datasheets/
- Moved image files (IMG_*) to docs/images/
- Automated by Gitea Actions auto-sort workflow
2025-08-11 04:47:17 +00:00
b8fd333f04 test DS
All checks were successful
Auto-Sort Files / auto-sort (push) Successful in 5s
2025-08-11 11:47:07 +07:00
e19ddeaa67 del files
All checks were successful
Auto-Sort Files / auto-sort (push) Successful in 4s
2025-08-11 11:41:50 +07:00
bc5df5f05c Auto-sort: Move DS_ and IMG_ prefixed files to correct directories
All checks were successful
Auto-Sort Files / auto-sort (push) Successful in 4s
- Moved datasheet files (DS_*) to docs/datasheets/
- Moved image files (IMG_*) to docs/images/
- Automated by Gitea Actions auto-sort workflow
2025-08-11 04:39:16 +00:00
9fa2e39f7c del files
Some checks failed
Auto-Sort Files / auto-sort (push) Has been cancelled
2025-08-11 11:39:07 +07:00
052156cc43 Merge branch 'main' of https://git.b4l.co.th/B4L/b4l-project-template
Some checks failed
Auto-Sort Files / auto-sort (push) Failing after 5s
2025-08-11 11:37:06 +07:00
eff0142a22 Fix git tracking issue in file movement
- Replace mv with git mv to preserve git file tracking
- Remove unnecessary git add step since git mv automatically stages changes
- Fix issue where moved files appeared as deleted in git status
- Ensure proper git history preservation when files are reorganized
- Files will now show as moved/renamed instead of deleted/added in git log
2025-08-11 11:36:49 +07:00
db2871fb5d Auto-sort: Move DS_ and IMG_ prefixed files to correct directories
Some checks failed
Auto-Sort Files / auto-sort (push) Failing after 4s
- Moved datasheet files (DS_*) to docs/datasheets/
- Moved image files (IMG_*) to docs/images/
- Automated by Gitea Actions auto-sort workflow
2025-08-11 04:34:29 +00:00
9bb593ec3a new file
All checks were successful
Auto-Sort Files / auto-sort (push) Successful in 6s
2025-08-11 11:34:20 +07:00
6ba8ca0357 Merge branch 'main' of https://git.b4l.co.th/B4L/b4l-project-template
Some checks failed
Auto-Sort Files / auto-sort (push) Failing after 5s
2025-08-11 11:32:18 +07:00
29b4ffe576 Add configurable worker credentials for git operations
- Replace hardcoded git user email and name with configurable variables
- Add WORKER_EMAIL and WORKER_USERNAME variables for git commits and authentication
- Update workflow to use vars.WORKER_EMAIL and vars.WORKER_USERNAME
- Use WORKER_USERNAME in push URL authentication instead of hardcoded 'ci-bot'
- Update GITEA-ACTIONS-SETUP.md with instructions for setting up repository variables
- Add variables to setup checklist for complete configuration
- Provide flexibility for different organizations and naming conventions
2025-08-11 11:31:59 +07:00
16 changed files with 902 additions and 31 deletions

View File

@@ -40,7 +40,8 @@ jobs:
# Move file if it's not already in the correct location # Move file if it's not already in the correct location
if [ "$src" != "$dest" ] && [ -f "$src" ]; then if [ "$src" != "$dest" ] && [ -f "$src" ]; then
echo "Moving: $src -> $dest" echo "Moving: $src -> $dest"
mv "$src" "$dest" # Use git mv to preserve git tracking
git mv "$src" "$dest"
return 0 # Success - file was moved return 0 # Success - file was moved
fi fi
return 1 # No file moved return 1 # No file moved
@@ -80,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 "ci-bot@b4l.co.th"
git config --local user.name "B4L CI Auto-Sort Bot"
git add docs/datasheets/ docs/images/
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
@@ -103,34 +92,44 @@ jobs:
# HTTPS URL format: https://git.b4l.co.th/B4L/repo-name.git # HTTPS URL format: https://git.b4l.co.th/B4L/repo-name.git
DOMAIN=$(echo $REPO_URL | sed 's|https://\([^/]*\)/.*|\1|') DOMAIN=$(echo $REPO_URL | sed 's|https://\([^/]*\)/.*|\1|')
REPO_PATH=$(echo $REPO_URL | sed 's|https://[^/]*/\(.*\)|\1|') REPO_PATH=$(echo $REPO_URL | sed 's|https://[^/]*/\(.*\)|\1|')
PUSH_URL="https://ci-bot:${{ secrets.CI_BOT_TOKEN }}@${DOMAIN}/${REPO_PATH}" PUSH_URL="https://${{ vars.WORKER_USERNAME }}:${{ secrets.CI_BOT_TOKEN }}@${DOMAIN}/${REPO_PATH}"
else else
# SSH URL format: git@git.b4l.co.th:B4L/repo-name.git # SSH URL format: git@git.b4l.co.th:B4L/repo-name.git
DOMAIN=$(echo $REPO_URL | sed 's|git@\([^:]*\):.*|\1|') DOMAIN=$(echo $REPO_URL | sed 's|git@\([^:]*\):.*|\1|')
REPO_PATH=$(echo $REPO_URL | sed 's|git@[^:]*:\(.*\)|\1|') REPO_PATH=$(echo $REPO_URL | sed 's|git@[^:]*:\(.*\)|\1|')
PUSH_URL="https://ci-bot:${{ secrets.CI_BOT_TOKEN }}@${DOMAIN}/${REPO_PATH}" PUSH_URL="https://${{ vars.WORKER_USERNAME }}:${{ secrets.CI_BOT_TOKEN }}@${DOMAIN}/${REPO_PATH}"
fi fi
echo "Repository URL: $REPO_URL" echo "Repository URL: $REPO_URL"
echo "Domain: $DOMAIN" echo "Domain: $DOMAIN"
echo "Repository Path: $REPO_PATH" echo "Repository Path: $REPO_PATH"
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 }}
- name: Create summary - name: Log results
run: | run: |
echo "## Auto-Sort Results" >> $GITHUB_STEP_SUMMARY # Check if files were moved by looking at the output from sort_files step
echo "" >> $GITHUB_STEP_SUMMARY FILES_MOVED_OUTPUT="${{ steps.sort_files.outputs.files_moved }}"
if [ "${{ steps.sort_files.outputs.files_moved }}" = "true" ]; then echo "Auto-Sort Results:"
echo "✅ Files were automatically moved to correct directories" >> $GITHUB_STEP_SUMMARY echo "Debug: files_moved output = '$FILES_MOVED_OUTPUT'"
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Moved Files:" >> $GITHUB_STEP_SUMMARY if [ "$FILES_MOVED_OUTPUT" = "true" ]; then
echo "- Datasheet files (DS_*) → docs/datasheets/" >> $GITHUB_STEP_SUMMARY echo "✅ Files were automatically moved to correct directories"
echo "- Image files (IMG_*) → docs/images/" >> $GITHUB_STEP_SUMMARY echo "- Datasheet files (DS_*) → docs/datasheets/"
echo "- Image files (IMG_*) → docs/images/"
else else
echo " No files needed to be moved - all files are properly organized" >> $GITHUB_STEP_SUMMARY echo " No files needed to be moved - all files are properly organized"
fi fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Supported Prefixes:" >> $GITHUB_STEP_SUMMARY echo "Supported Prefixes:"
echo "- **DS_**: Datasheets (PDF, DOC, DOCX, TXT)" >> $GITHUB_STEP_SUMMARY echo "- DS_: Datasheets (PDF, DOC, DOCX, TXT)"
echo "- **IMG_**: Images (PNG, JPG, SVG, GIF, PDF, WEBP)" >> $GITHUB_STEP_SUMMARY echo "- IMG_: Images (PNG, JPG, SVG, GIF, PDF, WEBP)"

Binary file not shown.

Binary file not shown.

View File

@@ -27,7 +27,19 @@ Ensure your Gitea instance has Actions enabled:
- Value: Paste the token from step 2 - Value: Paste the token from step 2
- Click "Add Secret" - Click "Add Secret"
### 4. Enable Repository Actions ### 4. Add Repository Variables
1. **Go to Repository Settings**:
- Navigate to your repository → Settings → Variables
2. **Add Worker Email Variable**:
- Name: `WORKER_EMAIL`
- Value: Email for git commits (e.g., `ci-bot@your-domain.com`)
- Click "Add Variable"
3. **Add Worker Username Variable**:
- Name: `WORKER_USERNAME`
- Value: Username for git commits (e.g., `CI Auto-Sort Bot`)
- Click "Add Variable"
### 5. Enable Repository Actions
1. **Repository Settings**: Go to Settings → Actions 1. **Repository Settings**: Go to Settings → Actions
2. **Enable Actions**: Check "Enable Actions" 2. **Enable Actions**: Check "Enable Actions"
3. **Allow all actions**: Select appropriate action permissions 3. **Allow all actions**: Select appropriate action permissions
@@ -53,6 +65,12 @@ on:
branches: [ main ] branches: [ main ]
``` ```
### Infinite Loop Prevention
The workflow uses the `[skip actions]` flag in commit messages to prevent infinite loops:
- When files are moved, the commit message includes `[skip actions]`
- This prevents the workflow from triggering again on its own commits
- Standard Gitea Actions approach for preventing recursive execution
### Authentication Method ### Authentication Method
The workflow uses token-based authentication and dynamically detects the repository URL: The workflow uses token-based authentication and dynamically detects the repository URL:
```yaml ```yaml
@@ -209,6 +227,8 @@ When reporting issues, include:
- [ ] Gitea Actions enabled on instance - [ ] Gitea Actions enabled on instance
- [ ] CI bot token created with `repo` scope - [ ] CI bot token created with `repo` scope
- [ ] `CI_BOT_TOKEN` secret added to repository - [ ] `CI_BOT_TOKEN` secret added to repository
- [ ] `WORKER_EMAIL` variable added to repository
- [ ] `WORKER_USERNAME` variable added to repository
- [ ] Repository Actions enabled - [ ] Repository Actions enabled
- [ ] Test files created and pushed - [ ] Test files created and pushed
- [ ] Workflow executed successfully - [ ] Workflow executed successfully

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 KiB