Skip to content

chore(deps): bump actions/cache from 5.0.5 to 6.1.0 #411

chore(deps): bump actions/cache from 5.0.5 to 6.1.0

chore(deps): bump actions/cache from 5.0.5 to 6.1.0 #411

Workflow file for this run

name: Code Checks
on:
pull_request:
merge_group:
types: [checks_requested]
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
enforce-copyright:
name: Enforce Copyright
runs-on: ubuntu-22.04
permissions:
contents: read
timeout-minutes: 10
steps:
- name: Generate GitHub App Token
id: app-token
if: ${{ github.event_name == 'merge_group' || github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login != 'dependabot[bot]' }}
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ secrets.CGBS_AUTOMATION_APP_CLIENT_ID }} # zizmor: ignore[secrets-outside-env]
private-key: ${{ secrets.CGBS_AUTOMATION_APP_PRIVATE_KEY }} # zizmor: ignore[secrets-outside-env]
permission-contents: write
- name: Checkout code | Internal
if: ${{ github.event_name == 'merge_group' || github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login != 'dependabot[bot]' }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.head_ref }}
persist-credentials: false
- name: Checkout code | External
if: ${{ github.event_name != 'merge_group' && github.event.pull_request.head.repo.full_name != github.repository || github.event.pull_request.user.login == 'dependabot[bot]' }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.head_ref }}
persist-credentials: false
- name: Set up Ruby
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
- name: Run Ruby Script
run: ruby ./copyright.rb
- name: Get GitHub App User ID
id: get-user-id
if: ${{ github.event_name != 'merge_group' && github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login != 'dependabot[bot]' }}
env:
APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: echo "user-id=$(gh api "/users/${APP_SLUG}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
- name: Commit changes
if: ${{ github.event_name != 'merge_group' && github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login != 'dependabot[bot]' }}
env:
APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
APP_USER_ID: ${{ steps.get-user-id.outputs.user-id }}
APP_TOKEN: ${{ steps.app-token.outputs.token }}
GH_REPOSITORY: ${{ github.repository }}
run: |
git config user.name "${APP_SLUG}[bot]"
git config user.email "${APP_USER_ID}+${APP_SLUG}[bot]@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${APP_TOKEN}@github.com/${GH_REPOSITORY}.git"
git add -A
git diff --cached --quiet || (git commit -m "chore: fix enforcement of copyright on all files" && git push)
- name: Check for changes
if: ${{ github.event_name == 'merge_group' || github.event.pull_request.head.repo.full_name != github.repository || github.event.pull_request.user.login == 'dependabot[bot]' }}
run: |
git add -A
if ! git diff --cached --quiet; then
echo "::error::Formatting changes were detected. Run the copyright script locally and commit the changes."
echo "::group::Diff"
git --no-pager diff --cached --color
echo "::endgroup::"
exit 1
fi
fix-code-style:
name: Fix Code Style
runs-on: ubuntu-22.04
permissions:
contents: read
timeout-minutes: 10
needs: [enforce-copyright]
steps:
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: '8.4'
coverage: none
- name: Generate GitHub App Token
id: app-token
if: ${{ github.event_name == 'merge_group' || github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login != 'dependabot[bot]' }}
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ secrets.CGBS_AUTOMATION_APP_CLIENT_ID }} # zizmor: ignore[secrets-outside-env]
private-key: ${{ secrets.CGBS_AUTOMATION_APP_PRIVATE_KEY }} # zizmor: ignore[secrets-outside-env]
permission-contents: write
- name: Checkout code | Internal
if: ${{ github.event_name == 'merge_group' || github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login != 'dependabot[bot]' }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.head_ref }}
persist-credentials: false
- name: Checkout code | External
if: ${{ github.event_name != 'merge_group' && github.event.pull_request.head.repo.full_name != github.repository || github.event.pull_request.user.login == 'dependabot[bot]' }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Dependencies
uses: ./.github/actions/composer-dependency-setup
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm install
- name: Cache PHP CS Fixer
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .php-cs-fixer.cache
key: ${{ runner.OS }}-${{ github.repository }}-phpcsfixer-${{ github.run_id }}
restore-keys: |
${{ runner.OS }}-${{ github.repository }}-phpcsfixer-
- name: Cache Prettier
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ./node_modules/.cache/prettier/.prettier-cache
key: ${{ runner.OS }}-${{ github.repository }}-prettier-${{ github.run_id }}
restore-keys: |
${{ runner.OS }}-${{ github.repository }}-prettier-
- name: Run Formatters
run: composer format
- name: Get GitHub App User ID
id: get-user-id
if: ${{ github.event_name != 'merge_group' && github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login != 'dependabot[bot]' }}
env:
APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: echo "user-id=$(gh api "/users/${APP_SLUG}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
- name: Commit changes
if: ${{ github.event_name != 'merge_group' && github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login != 'dependabot[bot]' }}
env:
APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
APP_USER_ID: ${{ steps.get-user-id.outputs.user-id }}
APP_TOKEN: ${{ steps.app-token.outputs.token }}
GH_REPOSITORY: ${{ github.repository }}
run: |
git config user.name "${APP_SLUG}[bot]"
git config user.email "${APP_USER_ID}+${APP_SLUG}[bot]@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${APP_TOKEN}@github.com/${GH_REPOSITORY}.git"
git add -A
git diff --cached --quiet || (git commit -m "chore: fix code style" && git push)
- name: Check for changes
if: ${{ github.event_name == 'merge_group' || github.event.pull_request.head.repo.full_name != github.repository || github.event.pull_request.user.login == 'dependabot[bot]' }}
run: |
git add -A
if ! git diff --cached --quiet; then
echo "::error::Formatting changes were detected. Run 'composer format' locally and commit the changes."
echo "::group::Diff"
git --no-pager diff --cached --color
echo "::endgroup::"
exit 1
fi
lint:
name: Lint
runs-on: ubuntu-22.04
permissions:
contents: read
timeout-minutes: 15
needs: [enforce-copyright, fix-code-style]
steps:
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: '8.4'
coverage: none
extensions: gd, gmp, redis
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
fetch-tags: true
persist-credentials: false
- name: Setup Dependencies
uses: ./.github/actions/composer-dependency-setup
- name: 'Restore result cache'
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: tmp
key: 'phpstan-result-cache-${{ github.run_id }}'
restore-keys: |
phpstan-result-cache-
- name: Linting
run: ./vendor/bin/phpstan analyse --configuration phpstan-ci.neon --no-progress
- name: 'Save result cache'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
if: ${{ !cancelled() }}
with:
path: tmp
key: 'phpstan-result-cache-${{ github.run_id }}'
test:
name: Test (PHP ${{ matrix.php }}, Laravel ${{ matrix.laravel }}, Filament ${{ matrix.filament }})
runs-on: ubuntu-22.04
permissions:
contents: read
timeout-minutes: 15
needs: [enforce-copyright, fix-code-style]
strategy:
fail-fast: false
matrix:
include:
- php: '8.4'
laravel: 12
laravel-constraint: '^12.0'
testbench-constraint: '^10.4'
filament: 4
filament-constraint: '^4.11.6'
- php: '8.5'
laravel: 13
laravel-constraint: '^13.0'
testbench-constraint: '^11.0'
filament: 5
filament-constraint: '^5.0'
- php: '8.4'
laravel: 13
laravel-constraint: '^13.0'
testbench-constraint: '^11.0'
filament: 4
filament-constraint: '^4.11.6'
steps:
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: ${{ matrix.php }}
coverage: none
extensions: gd, gmp, redis, mailparse
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
fetch-tags: true
persist-credentials: false
- name: Install Dependencies
env:
LARAVEL_CONSTRAINT: ${{ matrix.laravel-constraint }}
TESTBENCH_CONSTRAINT: ${{ matrix.testbench-constraint }}
FILAMENT_CONSTRAINT: ${{ matrix.filament-constraint }}
run: |
composer update \
--with="laravel/framework:${LARAVEL_CONSTRAINT}" \
--with="orchestra/testbench:${TESTBENCH_CONSTRAINT}" \
--with="filament/filament:${FILAMENT_CONSTRAINT}" \
--prefer-dist --no-ansi --no-interaction --no-progress --optimize-autoloader
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm install
- name: Execute tests
run: ./vendor/bin/pest --configuration phpunit.xml --parallel
request-copilot-review:
name: Request Copilot Review
runs-on: ubuntu-22.04
permissions: {}
# Only request a review once the code is known to be green, so Copilot never reviews
# code that is failing tests or linting. Automatic review must be disabled in the repo
# settings so this gated job is the only path that requests Copilot.
needs: [lint, test]
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login != 'dependabot[bot]' }}
timeout-minutes: 5
steps:
# The default GITHUB_TOKEN cannot reliably request Copilot as a reviewer, so act as the
# GitHub App instead. App tokens are exempt from the "GITHUB_TOKEN can't trigger further
# automation" rule, which lets Copilot's review actually start.
- name: Generate GitHub App Token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ secrets.CGBS_AUTOMATION_APP_CLIENT_ID }} # zizmor: ignore[secrets-outside-env]
private-key: ${{ secrets.CGBS_AUTOMATION_APP_PRIVATE_KEY }} # zizmor: ignore[secrets-outside-env]
permission-pull-requests: write
- name: Request review from Copilot
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
GH_REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
existing=$(gh api "/repos/${GH_REPOSITORY}/pulls/${PR_NUMBER}/requested_reviewers" --jq '.users[].login')
if echo "$existing" | grep -q 'copilot-pull-request-reviewer'; then
echo 'Copilot review already requested.'
exit 0
fi
if ! output=$(gh api \
--method POST \
-H 'Accept: application/vnd.github+json' \
"/repos/${GH_REPOSITORY}/pulls/${PR_NUMBER}/requested_reviewers" \
-f 'reviewers[]=copilot-pull-request-reviewer[bot]' 2>&1); then
echo "$output"
# Tolerate the reviewer already being assigned; fail on anything else.
echo "$output" | grep -qiE 'already|not a collaborator|review cannot be requested' || exit 1
fi