Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ updates:
assignees:
- "frugan-dev"
commit-message:
prefix: "deps"
prefix: "chore"
include: "scope"
labels:
- "dependencies"
Expand All @@ -27,7 +27,7 @@ updates:
assignees:
- "frugan-dev"
commit-message:
prefix: "ci"
prefix: "chore"
include: "scope"
labels:
- "dependencies"
Expand Down
61 changes: 52 additions & 9 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
types:
- opened
- synchronize
- reopened

permissions:
contents: write
pull-requests: write

jobs:
auto-merge:
Expand All @@ -23,26 +28,64 @@ jobs:
pull_number: context.issue.number
});

// Only auto-merge patch updates
// Auto-merge patch and minor updates
const title = pr.data.title.toLowerCase();
const isPatch = title.includes('patch') ||
title.match(/bump .+ from [\d]+\.[\d]+\.[\d]+ to [\d]+\.[\d]+\.[\d]+$/);
const isMinorOrPatch = title.includes('patch') ||
title.includes('minor') ||
title.match(/bump .+ from [\d]+\.[\d]+\.[\d]+ to [\d]+\.[\d]+\.[\d]+$/);

console.log('PR Title:', title);
console.log('Should merge:', isMinorOrPatch);

return { shouldMerge: isPatch };
return { shouldMerge: isMinorOrPatch };

- name: Wait for checks
- name: Auto-approve Dependabot PR
if: fromJSON(steps.pr.outputs.result).shouldMerge
run: |
gh pr review ${{ github.event.pull_request.number }} --approve --body "Auto-approving dependency update"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Wait for checks (with timeout)
if: fromJSON(steps.pr.outputs.result).shouldMerge
uses: fountainhead/action-wait-for-check@v1.2.0
id: wait-for-checks
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: 'Tests (PHP 8.4)'
ref: ${{ github.event.pull_request.head.sha }}
timeoutSeconds: 300
timeoutSeconds: 600
continue-on-error: true

- name: Auto-merge
if: fromJSON(steps.pr.outputs.result).shouldMerge && steps.wait-for-checks.outputs.conclusion == 'success'
- name: Check status and merge
if: fromJSON(steps.pr.outputs.result).shouldMerge
run: |
gh pr merge ${{ github.event.pull_request.number }} --squash --auto
# Get current status
STATUS=$(gh pr status ${{ github.event.pull_request.number }} --json statusCheckRollup --jq '.statusCheckRollup[] | select(.name == "Tests (PHP 8.4)") | .conclusion')

echo "Check status: $STATUS"

if [ "$STATUS" = "SUCCESS" ] || [ "$STATUS" = "NEUTRAL" ]; then
echo "✅ Checks passed, merging PR"
gh pr merge ${{ github.event.pull_request.number }} --squash --auto
elif [ "$STATUS" = "FAILURE" ]; then
echo "❌ Checks failed, not merging"
exit 1
else
echo "⏳ Checks still running or unknown status, enabling auto-merge"
gh pr merge ${{ github.event.pull_request.number }} --squash --auto
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Comment on failure
if: failure()
uses: actions/github-script@v8
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🤖 Auto-merge failed. Please check the CI status and merge manually if appropriate.'
});
8 changes: 6 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,17 @@ jobs:

- name: Upload coverage to Codecov
if: matrix.php == '8.4'
continue-on-error: true
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true
fail_ci_if_error: false

# Alternative
- name: Upload coverage to Qlty
if: matrix.php == '8.4'
continue-on-error: true
uses: qltysh/qlty-action/coverage@v2
with:
token: ${{ secrets.QLTY_TOKEN }}
Expand All @@ -97,6 +99,7 @@ jobs:
# Alternative
#- name: Upload coverage to Scrutinizer
# if: matrix.php == '8.4'
# continue-on-error: true
# uses: scrutinizer-ci/ocular@v1
# with:
# access-token: ${{ secrets.SCRUTINIZER_ACCESS_TOKEN }}
Expand Down Expand Up @@ -170,6 +173,7 @@ jobs:
args: --severity-threshold=high --sarif-file-output=snyk.sarif --file=composer.lock

- name: Upload Snyk results to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v3
continue-on-error: true
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: snyk.sarif
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
id: semantic
with:
# https://github.com/semantic-release/commit-analyzer/issues/65
# https://github.com/romap0/semantic-release-unsquash/issues/7
extra_plugins: |
semantic-release-unsquash@latest
@semantic-release/changelog@latest
@semantic-release/git@latest
conventional-changelog-conventionalcommits@latest
Expand Down
1 change: 0 additions & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
}
],
"plugins": [
"semantic-release-unsquash",
[
"@semantic-release/changelog",
{
Expand Down
16 changes: 15 additions & 1 deletion commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
import { RuleConfigSeverity } from '@commitlint/types';
import conventionalConfig from '@commitlint/config-conventional';

export default {
extends: ['@commitlint/config-conventional'],
ignores: [
(commit) => /\[skip ci\]/m.test(commit),
],
}
rules: {
'body-max-line-length': [RuleConfigSeverity.Error, 'always', 150],
'type-enum': [
RuleConfigSeverity.Error,
'always',
[
...conventionalConfig.rules['type-enum'][RuleConfigSeverity.Error],
'deps', // Add deps for Dependabot
],
],
},
}
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"povils/phpmnd": "^3.6",
"rector/rector": "^1.2|^2.1",
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.13",
"squizlabs/php_codesniffer": "^3.13 || ^4.0",
"vimeo/psalm": "^5.26|^6.13"
},
"suggest": {
Expand Down Expand Up @@ -72,10 +72,11 @@
"analysis": "@check --tasks=phpstan",
"check": "@php -d max_execution_time=0 -d memory_limit=-1 -f ./vendor/bin/grumphp -- run",
"ci": "@check --no-interaction",
"lint": "@check --tasks=phpcsfixer,phplint,phpstan,rector",
"lint": "@check --tasks=phpcsfixer,phplint,rector",
"quality": "@check --tasks=phpmnd,phpparser",
"rector": "@php -d max_execution_time=0 -d memory_limit=-1 -f ./vendor/bin/rector -- process --ansi --clear-cache",
"security": "@check --tasks=securitychecker_roave",
"test": "@check --tasks=phpunit",
"test:coverage": "vendor/bin/phpunit --coverage-clover=coverage.xml"
"test:coverage": "@php -d max_execution_time=0 -d memory_limit=-1 ./vendor/bin/phpunit --coverage-clover=coverage.xml"
}
}
8 changes: 4 additions & 4 deletions grumphp.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ grumphp:

# Psalm - Additional Static Analysis
#FIXME - Temporarily disabled for PHP 8.4 compatibility
# psalm:
# config: psalm.xml.dist
# ignore_patterns: ['vendor']
# threads: 4
#psalm:
# config: psalm.xml.dist
# ignore_patterns: ['vendor']
# threads: 4

# Rector - Automated Refactoring
rector: ~
Expand Down
Loading