Skip to content

geotiff: follow-up review nits from #1984 PRs 2 and 5 #34

geotiff: follow-up review nits from #1984 PRs 2 and 5

geotiff: follow-up review nits from #1984 PRs 2 and 5 #34

name: Welcome new contributor
on:
pull_request_target:
types: [opened]
permissions:
pull-requests: write
issues: read
contents: read
jobs:
welcome:
# Skip drafts and same-repo PRs. The event-payload ``author_association``
# is unreliable across both same-repo PRs (reports CONTRIBUTOR for actual
# MEMBERs, per the copilot-review.yml note) and cross-fork PRs from
# maintainers' personal forks (also seen reporting non-MEMBER). The
# maintainer-skip is enforced inside the step via the collaborator
# permission API instead.
if: >-
github.event.pull_request.draft == false &&
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
steps:
- name: Comment if no intro issue exists
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
REPO: ${{ github.repository }}
run: |
# Skip maintainers. Query the live collaborator permission API
# rather than trusting the event payload's author_association, which
# has been observed to misreport MEMBERs as plain CONTRIBUTOR on
# cross-fork PRs (PR #1968 welcomed an admin maintainer).
perm=$(gh api "repos/$REPO/collaborators/$PR_AUTHOR/permission" \
--jq '.permission' 2>/dev/null || echo "none")
echo "Collaborator permission for $PR_AUTHOR: $perm"
case "$perm" in
admin|maintain|write)
echo "Author is a maintainer; skipping welcome comment."
exit 0
;;
esac
count=$(gh issue list \
--repo "$REPO" \
--author "$PR_AUTHOR" \
--state all \
--search 'in:title "Contributor intro:"' \
--json number --jq 'length')
echo "Intro-issue count for $PR_AUTHOR: $count"
if [ "$count" -gt 0 ]; then
echo "Author already filed an intro issue; skipping."
exit 0
fi
gh pr comment "$PR_NUMBER" --repo "$REPO" --body "Hi @${PR_AUTHOR}, thanks for the PR!
Would you mind filing a quick [New contributor introduction](https://github.com/${REPO}/issues/new?template=new-contributor.md) issue when you get a chance? It helps us point you at issues that fit what you'd like to work on. Most fields are optional.
Reviewing your PR doesn't depend on it, just a friendly nudge."