Convert CI auto-sort system to Gitea Actions

- Move workflow from ci/auto-sort-files.yml to .gitea/workflows/auto-sort-files.yml
- Update workflow to use CI_BOT_TOKEN secret for Gitea authentication
- Configure proper git push URL for Gitea repository
- Update ci/README.md with comprehensive Gitea Actions setup instructions
- Add GITEA-ACTIONS-SETUP.md with detailed configuration guide
- Update README.md to reference Gitea Actions setup documentation
- Remove old GitHub Actions workflow file
- Provide step-by-step token creation and repository secret configuration
- Include troubleshooting guide and security considerations
This commit is contained in:
2025-08-11 10:47:39 +07:00
parent 97096f519d
commit e3b480ec33
4 changed files with 259 additions and 16 deletions

View File

@@ -67,18 +67,46 @@ The workflow can be customized by editing `auto-sort-files.yml`:
## Setup Instructions
### GitHub Actions
1. The workflow file is already configured in `.github/workflows/` (copy from `ci/auto-sort-files.yml`)
2. Ensure repository has appropriate permissions for the action to commit
3. The workflow will run automatically on pushes and pull requests
### Gitea Actions (Recommended)
This template is optimized for Gitea Actions. The workflow is already configured in `.gitea/workflows/auto-sort-files.yml`.
### GitLab CI
#### Required Setup:
1. **Enable Gitea Actions** on your Gitea instance
2. **Create CI Bot Token**:
- Go to your Gitea user settings → Applications → Generate New Token
- Name: `CI Auto-Sort Bot`
- Scopes: `repo` (full repository access)
- Copy the generated token
3. **Add Repository Secret**:
- Go to your repository → Settings → Secrets
- Add new secret: `CI_BOT_TOKEN`
- Value: Paste the token from step 2
4. **Enable Actions**: Go to repository Settings → Actions → Enable Actions
#### Token Configuration:
The workflow uses `${{ secrets.CI_BOT_TOKEN }}` to authenticate git operations. This token must have:
- **Repository access**: Read and write permissions
- **Contents permission**: To commit and push changes
- **Actions permission**: To run workflows
#### Verification:
- Push a test file with DS_ or IMG_ prefix to verify the workflow runs
- Check the Actions tab in your repository for workflow execution logs
- Verify that files are automatically moved to correct directories
### GitHub Actions (Alternative)
If using GitHub instead of Gitea:
1. Copy `.gitea/workflows/auto-sort-files.yml` to `.github/workflows/`
2. Replace `CI_BOT_TOKEN` with `GITHUB_TOKEN` in the workflow
3. Update the push URL to use GitHub's format
### GitLab CI (Alternative)
To adapt for GitLab CI, create `.gitlab-ci.yml`:
```yaml
auto-sort:
stage: organize
script:
- # Copy the bash script from auto-sort-files.yml
- # Copy the bash script from .gitea/workflows/auto-sort-files.yml
only:
- main
- develop