<!-- .github/pull_request_template.md --> ## Description Fix “Resource not accessible by integration” error in greetings workflow This PR updates the community | Greetings GitHub Actions workflow to ensure it can successfully post greeting comments on newly opened issues and pull requests — including PRs from forks — without hitting the “Resource not accessible by integration” error. ## Changes - Switched PR trigger from `pull_request` to `pull_request_target` to run in the context of the base repository and grant write-scoped `GITHUB_TOKEN` for commenting on forked PRs. - Added explicit `permissions` block with: - `issues: write` - `pull-requests: write` - Limited triggers to `types: [opened]` for both issues and PRs to avoid unnecessary runs. - Preserved existing greeting messages for issues and pull requests. ## Reason for change The workflow was failing because the default `GITHUB_TOKEN` in `pull_request` events is read-only for forks, preventing the bot from posting comments. `pull_request_target` with explicit permissions solves this while maintaining security. ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin.
24 lines
686 B
YAML
24 lines
686 B
YAML
name: community | Greetings
|
|
|
|
on:
|
|
issues:
|
|
types: [opened]
|
|
pull_request_target:
|
|
types: [opened]
|
|
|
|
permissions:
|
|
issues: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
greeting:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/first-interaction@v1
|
|
with:
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
pr-message: 'Hello @${{ github.actor }}, thank you for submitting a PR! We will respond as soon as possible.'
|
|
issue-message: |
|
|
Hello @${{ github.actor }}, thank you for your interest in our work!
|
|
|
|
If this is a bug report, please provide screenshots and **minimum viable code to reproduce your issue**, otherwise we can not help you.
|