mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-07-07 04:53:01 +01:00
pull_request gives fork PRs a read-only token, so the sticky comment can't be posted from pr-title.yml. Split the comment into pr-title-comment.yml (workflow_run), which runs from the base branch with a write token and works for forks. pr-title.yml stays the required check (runs on the PR branch, forks included, no deadlock) and hands the lint result to the commenter via an artifact. workflow_run only fires once this workflow is on the default branch, so it activates for fork PRs after merge; the required check is unaffected.
43 lines
1.3 KiB
YAML
43 lines
1.3 KiB
YAML
name: 📝 PR Title
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, edited, synchronize, reopened]
|
|
branches: [develop, master]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
validate_pr_title:
|
|
name: "📝 Validate PR Title"
|
|
runs-on: ubuntu-26.04
|
|
steps:
|
|
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
|
|
id: lint_pr_title
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# Fork PRs only get a read-only GITHUB_TOKEN here, so the sticky comment
|
|
# is posted from the privileged pr-title-comment.yml (workflow_run). Hand
|
|
# off the result (PR number + lint error) as an artifact for it to read.
|
|
- if: always()
|
|
env:
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
LINT_ERROR: ${{ steps.lint_pr_title.outputs.error_message }}
|
|
run: |
|
|
mkdir -p pr-title-result
|
|
printf '%s' "$PR_NUMBER" > pr-title-result/number
|
|
printf '%s' "$LINT_ERROR" > pr-title-result/error
|
|
|
|
- if: always()
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: pr-title-result
|
|
path: pr-title-result/
|
|
retention-days: 1
|