Skip to content
Open
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
18 changes: 16 additions & 2 deletions .github/workflows/merge-maintained-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ jobs:
merge:
name: Merge branch
runs-on: ubuntu-latest
environment:
name: push
deployment: false
permissions:
contents: read # for actions/checkout to fetch the code; the merge is made with PHPSTAN_BOT_TOKEN
contents: read # for actions/checkout to fetch the code; the merge is made with a phpstan-push App token
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
Expand All @@ -29,10 +32,21 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: "Mint a push token for phpstan/phpdoc-parser"
id: push-token
uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
with:
client-id: ${{ vars.PUSH_APP_CLIENT_ID }}
private-key: ${{ secrets.PUSH_APP_PRIVATE_KEY }}
repositories: phpdoc-parser
permission-contents: write
# the merge may bring changes to .github/workflows
permission-workflows: write

- name: "Merge branch"
uses: everlytic/branch-merge@c4a244dc23143f824ae6c022a10732566cb8e973 # 1.1.5
with:
github_token: "${{ secrets.PHPSTAN_BOT_TOKEN }}"
github_token: ${{ steps.push-token.outputs.token }}
source_ref: ${{ github.ref }}
target_branch: '1.23.x'
commit_message_template: 'Merge branch {source_ref} into {target_branch}'
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: "Deploy"
runs-on: "ubuntu-latest"
permissions:
contents: read # for actions/checkout to fetch the code; the release is created with PHPSTAN_BOT_TOKEN
contents: read # for actions/checkout to fetch the code; the release is created as phpstan-bot with PHPSTAN_BOT_CONTENTS_TOKEN

steps:
- name: Harden the runner (Audit all outbound calls)
Expand All @@ -35,12 +35,12 @@ jobs:
id: changelog
uses: metcalfc/changelog-generator@bb7a08e07e326061351dab6ce89c72f13797043c # v4.9.1
with:
myToken: ${{ secrets.PHPSTAN_BOT_TOKEN }}
myToken: ${{ github.token }}

- name: "Create release"
run: 'gh release create "$TAG" --verify-tag --title "$TAG" --notes "$CHANGELOG"'
env:
GH_TOKEN: ${{ secrets.PHPSTAN_BOT_TOKEN }}
GH_TOKEN: ${{ secrets.PHPSTAN_BOT_CONTENTS_TOKEN }}
GH_REPO: ${{ github.repository }}
TAG: ${{ github.ref_name }}
CHANGELOG: ${{ steps.changelog.outputs.changelog }}
8 changes: 5 additions & 3 deletions .github/workflows/send-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
types: [published]

# GITHUB_TOKEN needs no permissions: phpstan-src is checked out and the pull request
# is sent with PHPSTAN_BOT_TOKEN.
# is sent as phpstan-bot with PHPSTAN_BOT_PULL_REQUESTS_TOKEN from the bot-pr environment.
permissions: {}

concurrency:
Expand All @@ -18,6 +18,9 @@ jobs:
send-pr:
name: "Send pull request"
runs-on: "ubuntu-latest"
environment:
name: bot-pr
deployment: false
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
Expand All @@ -36,7 +39,6 @@ jobs:
persist-credentials: false
repository: phpstan/phpstan-src
path: phpstan-src
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}
ref: 2.3.x

- name: "Install dependencies"
Expand All @@ -55,7 +57,7 @@ jobs:
id: create-pr
uses: peter-evans/create-pull-request@3ffccacd46053766916f087ce41d627c0b8cf2d1 # v8.1.3
with:
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}
token: ${{ secrets.PHPSTAN_BOT_PULL_REQUESTS_TOKEN }}
path: ./phpstan-src
branch-suffix: random
delete-branch: true
Expand Down
3 changes: 2 additions & 1 deletion .github/zizmor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ rules:
# send-pr, merge-maintained-branch, release-toot, release-tweet). Moving them into
# dedicated environments has to be done in the repository settings first.
allow:
- PHPSTAN_BOT_TOKEN
- PHPSTAN_BOT_CONTENTS_TOKEN
- RELEASE_DISPATCH_TOKEN
- MASTODON_ACCESS_TOKEN
- TWITTER_CONSUMER_API_KEY
- TWITTER_CONSUMER_API_SECRET
Expand Down
Loading