Enhance PR agent configuration with review settings and workflow updates #52
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint | |
on: # yamllint disable-line rule:truthy | |
push: null | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
# To report GitHub Actions status checks | |
statuses: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
# super-linter needs the full git history to get the | |
# list of files that changed across commits | |
fetch-depth: 0 | |
- name: Super-linter | |
uses: super-linter/super-linter@v7.4.0 # x-release-please-version | |
continue-on-error: true | |
env: | |
# To report GitHub Actions status checks | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Enable auto-fix | |
AUTO_FIX: true | |
# Linter rules path (optional) | |
LINTER_RULES_PATH: .github/linters | |
FIX_SHELL_SHFMT: true | |
FIX_YAML_PRETTIER: true | |
FIX_JAVASCRIPT_PRETTIER: true | |
FIX_JAVASCRIPT_STANDARD: true | |
FIX_MARKDOWN: true | |
FIX_MARKDOWN_PRETTIER: true | |
FIX_DOCKERFILE: true | |
FIX_JSON_PRETTIER: true | |
FIX_JSON: true | |
FIX_ENV: true | |
JSCPD_CONFIG_FILE: .jscpd.json | |
- name: Check for changes | |
id: check_changes | |
run: | | |
if [[ -n "$(git status --porcelain)" ]]; then | |
echo "has_changes=true" >> "$GITHUB_OUTPUT" | |
else | |
echo "has_changes=false" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Show workflow lint result | |
run: | | |
git diff .github/workflows/ | |
- name: Create Pull Request | |
if: steps.check_changes.outputs.has_changes == 'true' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# 获取当前分支 | |
CURRENT_BRANCH=$(git branch --show-current) | |
# 生成分支名 | |
BRANCH_NAME="auto-fix/linting-$(date +%s)" | |
# 配置git | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
# 添加和提交更改 | |
git add . | |
git commit -m "chore: auto-fix linting issues" | |
# 创建并推送新分支 | |
git checkout -b "$BRANCH_NAME" | |
git push origin "$BRANCH_NAME" | |
# 创建PR | |
gh pr create \ | |
--title "chore: auto-fix linting issues" \ | |
--body "This PR contains automatic fixes for linting issues found by super-linter. | |
## Changes made: | |
- Auto-fixed formatting issues | |
- Resolved linting violations | |
- Improved code quality | |
This PR was automatically generated by the linting workflow." \ | |
--base "$CURRENT_BRANCH" \ | |
--head "$BRANCH_NAME" |