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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 18 additions & 0 deletions .github/policies/pull-request-automation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "pull-request-automation",
"enforcement": "active",
"conditions": {
"workflow_path": {
"include": [".github/workflows/pull-request-automation.yml"],
"exclude": []
}
},
"rules": [
{
"type": "restrict_action_events",
"parameters": {
"allowed_events": ["pull_request_target"]
}
}
]
}
67 changes: 67 additions & 0 deletions .github/workflows/pull-request-automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: pull-request-automation

on:
# zizmor: ignore[dangerous-triggers]
pull_request_target:
types: ["opened", "edited", "reopened", "ready_for_review", "synchronize", "closed"]

permissions: {}

jobs:
pull-request-size:
runs-on: ubuntu-24.04
if: ${{ github.event.action != 'closed' }}
continue-on-error: true
permissions:
pull-requests: write
steps:
- uses: codelytv/pr-size-labeler@19c335e7695ba922de938806dd129f0a9b992644 # v1.12.0
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
xs_label: 'size: XS'
xs_max_size: 50
s_label: 'size: S'
s_max_size: 250
m_label: 'size: M'
m_max_size: 500
l_label: 'size: L'
l_max_size: 1000
xl_label: 'size: XL'
fail_if_xl: false
files_to_ignore: 'composer.lock timezones.json nested_timezones.json'
message_if_xl: ''

dependabot:
runs-on: ubuntu-24.04
if: ${{ github.event.action != 'closed' && github.event.pull_request.user.login == 'dependabot[bot]' }}
permissions:
contents: write
pull-requests: write
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

pull-request-caches:
runs-on: ubuntu-24.04
if: ${{ github.event.action == 'closed' }}
permissions:
actions: write
steps:
- name: "Delete the caches of the closed pull request"
env:
GH_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}
CACHE_REF: refs/pull/${{ github.event.pull_request.number }}/merge
run: |
for id in $(gh cache list --repo "$REPOSITORY" --ref "$CACHE_REF" --limit 1000 --json id --jq '.[].id'); do
gh cache delete "$id" --repo "$REPOSITORY"
done
65 changes: 2 additions & 63 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
name: pull-request

on:
# zizmor: ignore[dangerous-triggers]
pull_request_target:
types: ["opened", "edited", "reopened", "ready_for_review", "synchronize", "closed"]
pull_request:
types: ["opened", "edited", "reopened", "ready_for_review", "synchronize"]

permissions: {}

jobs:
# Code borrowed from: https://github.com/carthage-software/mago/blob/main/.github/workflows/commit-authorship.yml
check-commit-authorship:
runs-on: ubuntu-24.04
if: ${{ github.event.action != 'closed' }}
permissions:
pull-requests: read
# See https://stackoverflow.com/a/72408109
Expand Down Expand Up @@ -70,7 +68,6 @@ jobs:

pull-request-description:
runs-on: ubuntu-24.04
if: ${{ github.event.action != 'closed' }}
permissions:
contents: read
steps:
Expand All @@ -81,61 +78,3 @@ jobs:
with:
entrypoint: "/composer/vendor/bin/automation"
args: "pull-request:description:check ${{ github.repository }} ${{ github.event.pull_request.number }} --skip-from=\"dependabot[bot]\""

pull-request-size:
runs-on: ubuntu-24.04
if: ${{ github.event.action != 'closed' }}
continue-on-error: true
permissions:
pull-requests: write
steps:
- uses: codelytv/pr-size-labeler@19c335e7695ba922de938806dd129f0a9b992644 # v1.12.0
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
xs_label: 'size: XS'
xs_max_size: 50
s_label: 'size: S'
s_max_size: 250
m_label: 'size: M'
m_max_size: 500
l_label: 'size: L'
l_max_size: 1000
xl_label: 'size: XL'
fail_if_xl: false
files_to_ignore: 'composer.lock timezones.json nested_timezones.json'
message_if_xl: ''

dependabot:
runs-on: ubuntu-24.04
if: ${{ github.event.action != 'closed' && github.event.pull_request.user.login == 'dependabot[bot]' }}
permissions:
contents: write
pull-requests: write
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

pull-request-caches:
runs-on: ubuntu-24.04
if: ${{ github.event.action == 'closed' }}
permissions:
actions: write
steps:
- name: "Delete the caches of the closed pull request"
env:
GH_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}
CACHE_REF: refs/pull/${{ github.event.pull_request.number }}/merge
run: |
for id in $(gh cache list --repo "$REPOSITORY" --ref "$CACHE_REF" --limit 1000 --json id --jq '.[].id'); do
gh cache delete "$id" --repo "$REPOSITORY"
done
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ jobs:
dependencies:
- "locked"
php-version:
- "8.3"
- "8.5"

steps:
- name: "Checkout"
Expand Down Expand Up @@ -370,7 +370,7 @@ jobs:
fail-fast: false
matrix:
php-version:
- "8.3"
- "8.5"

steps:
- name: "Checkout"
Expand Down Expand Up @@ -433,7 +433,6 @@ jobs:
DOMAIN: flow-php.com
PLAYGROUND_API_URL: https://flow-php.com/api/playground/snippets
PLAYGROUND_SNIPPETS_URL: https://playground-snippets.flow-php.com
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FLOW_VERSION: ${{ steps.flow_version.outputs.tag }}
working-directory: "web/landing"

Expand Down Expand Up @@ -516,7 +515,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.3"
- "8.5"
operating-system:
- "ubuntu-24.04"

Expand Down
Loading
Loading