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: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@
/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
composer.lock export-ignore
phpstan.neon export-ignore

/docs export-ignore
/docs export-ignore
3 changes: 3 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Security Policy

If you discover any security related issues, please email manuk.minasyan1@gmail.com instead of using the issue tracker.
45 changes: 45 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,50 @@ updates:
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 7
groups:
github-actions:
patterns:
- "*"
labels:
- "dependencies"

- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 7
groups:
composer:
patterns:
- "*"
labels:
- "dependencies"

- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 7
groups:
npm:
patterns:
- "*"
labels:
- "dependencies"

- package-ecosystem: "npm"
directory: "/docs"
schedule:
interval: "weekly"
cooldown:
default-days: 7
groups:
npm:
patterns:
- "*"
labels:
- "dependencies"
14 changes: 9 additions & 5 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
name: Auto-Merge

on: pull_request_target
on: pull_request

permissions:
pull-requests: write
contents: write
contents: read

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}

permissions:
pull-requests: write
contents: write

steps:

- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v3.1.0
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,18 @@ jobs:
esac

- name: Checkout source branch
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ steps.version.outputs.branch }}

- name: Checkout gh-pages
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: gh-pages
path: gh-pages

- name: Setup Node.js
uses: actions/setup-node@v7
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '20'
cache: 'npm'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.head_ref }}

- name: Fix PHP code style issues
uses: aglipanci/laravel-pint-action@2.6
uses: aglipanci/laravel-pint-action@36de00d5f5a8a4e12d443e01671daa12a18f4c79 # 2.6

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v7
uses: stefanzweifel/git-auto-commit-action@4a55954c782fc1ea30b9056cd3e7a2b40ca8887d # v7.2.0
with:
commit_message: Fix styling
71 changes: 44 additions & 27 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,89 +6,104 @@ on:
- 'v*.*.*'

permissions:
contents: write
contents: read

jobs:
tests:
uses: ./.github/workflows/tests.yml
secrets: inherit

release:
needs: tests
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Determine if pre-release
id: prerelease
env:
TAG: ${{ github.ref_name }}
run: |
TAG="${{ github.ref_name }}"
if [[ "$TAG" == *"-"* ]]; then
echo "flag=--prerelease" >> $GITHUB_OUTPUT
echo "flag=--prerelease" >> "$GITHUB_OUTPUT"
else
echo "flag=" >> $GITHUB_OUTPUT
echo "flag=" >> "$GITHUB_OUTPUT"
fi

- name: Check if release exists
id: check
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
if gh release view "${{ github.ref_name }}" > /dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
if gh release view "$TAG" > /dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create GitHub Release
if: steps.check.outputs.exists == 'false'
run: gh release create "${{ github.ref_name }}" --generate-notes ${{ steps.prerelease.outputs.flag }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
PRERELEASE_FLAG: ${{ steps.prerelease.outputs.flag }}
run: gh release create "$TAG" --generate-notes $PRERELEASE_FLAG

changelog:
needs: release
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Determine target branch
id: branch
env:
TAG: ${{ github.ref_name }}
REPO: ${{ github.repository }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
TAG="${{ github.ref_name }}"
MAJOR=$(echo "$TAG" | sed -E 's/^v?([0-9]+)\..*/\1/')
BRANCH="${MAJOR}.x"
if ! git ls-remote --exit-code --heads "https://github.com/${{ github.repository }}" "$BRANCH" > /dev/null 2>&1; then
BRANCH="${{ github.event.repository.default_branch }}"
if ! git ls-remote --exit-code --heads "https://github.com/$REPO" "$BRANCH" > /dev/null 2>&1; then
BRANCH="$DEFAULT_BRANCH"
fi
echo "name=${BRANCH}" >> $GITHUB_OUTPUT
echo "name=${BRANCH}" >> "$GITHUB_OUTPUT"

- name: Checkout code
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ steps.branch.outputs.name }}
ssh-key: ${{ secrets.DEPLOY_KEY }}

- name: Get release notes
id: notes
run: |
NOTES=$(gh release view "${{ github.ref_name }}" --json body --jq .body)
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "body<<$EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
NOTES=$(gh release view "$TAG" --json body --jq .body)
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
{
echo "body<<$EOF"
echo "$NOTES"
echo "$EOF"
} >> "$GITHUB_OUTPUT"

- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
uses: stefanzweifel/changelog-updater-action@a938690fad7edf25368f37e43a1ed1b34303eb36 # v1.12.0
with:
latest-version: ${{ github.ref_name }}
release-notes: ${{ steps.notes.outputs.body }}

- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v7
uses: stefanzweifel/git-auto-commit-action@4a55954c782fc1ea30b9056cd3e7a2b40ca8887d # v7.2.0
with:
branch: ${{ steps.branch.outputs.name }}
commit_message: "chore: update CHANGELOG for ${{ github.ref_name }}"
Expand All @@ -103,7 +118,9 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Delete tag on test failure
run: git push --delete origin "${{ github.ref_name }}"
env:
TAG: ${{ github.ref_name }}
run: git push --delete origin "$TAG"
34 changes: 32 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,37 @@ on:
branches: [3.x]
workflow_call:

permissions:
contents: read

jobs:
actions-pinned:
name: Actions pinned to SHA
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Assert every third-party action is pinned to a full commit SHA
run: |
unpinned=$(grep -rhoE '^[[:space:]]*-?[[:space:]]*uses:[[:space:]]*[^[:space:]]+' .github/workflows \
| sed -E 's/.*uses:[[:space:]]*//' \
| grep -v '^\./' \
| grep -vE '@[0-9a-f]{40}$' \
| sort -u || true)

if [ -n "$unpinned" ]; then
echo "Third-party actions must be pinned to a full 40-character commit SHA."
echo "Unpinned references:"
echo "$unpinned" | sed 's/^/ /'
exit 1
fi

echo "All third-party action references are pinned to a full commit SHA."

tests:
runs-on: ubuntu-latest
strategy:
Expand All @@ -26,10 +56,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Setup PHP
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/zizmor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Zizmor

on:
push:
paths:
- '.github/workflows/**'
- '.github/dependabot.yml'
pull_request:
paths:
- '.github/workflows/**'
- '.github/dependabot.yml'

permissions:
contents: read

jobs:
zizmor:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write

steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Audit workflows
uses: zizmorcore/zizmor-action@3dc1ecc9bcb9e94e9b2c709687979e1298497054 # v0.6.2