Improve Gitea Actions workflow with dynamic repository URL detection

- Update .gitea/workflows/auto-sort-files.yml to dynamically fetch repository URL using git config
- Support both HTTPS and SSH repository URL formats automatically
- Remove hardcoded repository URL for better portability across different repositories
- Add intelligent URL parsing to construct proper authenticated push URL
- Update GITEA-ACTIONS-SETUP.md to document dynamic URL detection feature
- Improve workflow flexibility for template reuse across different projects
This commit is contained in:
2025-08-11 11:02:56 +07:00
parent e3b480ec33
commit 4c1813005e
2 changed files with 26 additions and 2 deletions

View File

@@ -54,7 +54,7 @@ on:
```
### Authentication Method
The workflow uses token-based authentication:
The workflow uses token-based authentication and dynamically detects the repository URL:
```yaml
- name: Checkout repository
uses: actions/checkout@v4
@@ -62,6 +62,13 @@ The workflow uses token-based authentication:
token: ${{ secrets.CI_BOT_TOKEN }}
```
The push operation automatically detects the repository URL:
```bash
# Get the repository URL dynamically
REPO_URL=$(git config --get remote.origin.url)
# Supports both HTTPS and SSH repository URLs
```
## 🧪 Testing the Setup
### 1. Create Test Files