-
Notifications
You must be signed in to change notification settings - Fork 32
feat: Add first interaction workflow for new contributors #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yogeshkumawat2027
wants to merge
2
commits into
AOSSIE-Org:main
Choose a base branch
from
yogeshkumawat2027:feat/add-first-interaction-workflow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| name: First Interaction | ||
|
|
||
| on: | ||
| issues: | ||
| types: [opened] | ||
| pull_request_target: | ||
| types: [opened] | ||
|
|
||
| jobs: | ||
| greeting: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| issues: write | ||
| pull-requests: write | ||
| steps: | ||
| - uses: actions/first-interaction@v1 | ||
| with: | ||
| repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
| issue-message: | | ||
| π **Welcome to NeuroTrack!** | ||
|
|
||
| Thank you for opening your first issue! We're excited to have you as part of our community. π | ||
|
|
||
| A maintainer will review your issue soon. In the meantime, please make sure you've provided all the necessary details to help us understand and address the issue effectively. | ||
|
|
||
| If you'd like to contribute code, check out our [Contributing Guidelines](../CONTRIBUTING.md) to get started. | ||
|
|
||
| Happy coding! π | ||
| pr-message: | | ||
| π **Congratulations on your first Pull Request!** | ||
|
|
||
| Thank you for contributing to NeuroTrack! We really appreciate your effort and time. π | ||
|
|
||
| Our team will review your PR as soon as possible. Here are some things that might help: | ||
|
|
||
| - Make sure all tests pass β | ||
| - Ensure your code follows our coding standards π | ||
| - Check that your PR description clearly explains what changes you've made and why π | ||
|
|
||
| If you haven't already, please take a look at our [Contributing Guidelines](../CONTRIBUTING.md). | ||
|
|
||
| Thanks again for your contribution! π | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π§© Analysis chain
π Web query:
GitHub Actions pull_request_target security best practices write permissions minimal permissionsπ‘ Result:
Short checklist β secure use of pull_request_target + minimal write permissions
Prefer pull_request (unprivileged) for building/running untrusted code; use pull_request_target only for metadata ops (labels/comments) that must run with repo context. If you must build PR code, run it in an unprivileged job and then use workflow_run to perform privileged updates. [1][2][3]
Set least-privilege GITHUB_TOKEN explicitly with the permissions key (at workflow or job level). Grant only the specific scopes needed (for example contents: read; issues: write only if commenting; pull-requests: write only if updating PRs). Avoid leaving defaults. Example:
permissions:
contents: read
issues: none
pull-requests: write
[4][5]
Never checkout or execute untrusted fork code in a pull_request_target job. actions/checkout of the PR head in a privileged context is a common pwn-request vector. If you must access PR HEAD, do so in an unprivileged pull_request job. [2][6]
Avoid secrets in runs triggered by external contributors. pull_request_target has access to repository secrets β do not expose secrets to workflows that process untrusted input. Use OIDC where possible instead of long-lived secrets. [2][5]
Use a two-stage pattern for PR checks:
Scope third-party actions and reusable workflows: pin to full commit SHAs, review action code, and minimize the actions permission (actions: none) unless required. [5]
Use labels/βsafe to testβ gating and manual approvals for runs that need elevated privileges. Combine repository branch protection and required reviewers to prevent automatic merges from untrusted workflows. [6][8]
Monitor and iterate: use tools (GitHub Security Lab / actions-permissions Monitor & Advisor) or instrumented runs to observe the real permissions your workflows use and then tighten permissions to the minimal set. [3]
Quick examples / references
Sources
[1] GitHub Blog β Four tips to keep your GitHub Actions workflows secure.
[2] GitHub Security Lab β Keeping your GitHub Actions and workflows secure: Preventing pwn requests.
[3] GitHubSecurityLab/actions-permissions (Monitor & Advisor) repo.
[4] GitHub Docs β Assigning permissions to jobs / Use GITHUB_TOKEN.
[5] GitHub Docs β Security hardening for GitHub Actions (OIDC, pin actions, disable automation).
[6] CodeQL docs β Checkout of untrusted code in a privileged context.
(If you want, I can convert this into a ready-to-drop workflow template that enforces minimal permissions and the two-stage pattern.)
π Web query:
GitHub Actions first-interaction latest version release pinning commit SHA vs tagπ‘ Result:
Short answer
Why
Practical guidance
Sources
π Web query:
relative links GitHub issue PR comments resolve ../CONTRIBUTING.mdπ‘ Result:
Short answer: GitHub's relative-link resolution works when rendering Markdown files in the repo (README, docs, etc.) but is unreliable in PR/issue comments and some template contexts β so ../CONTRIBUTING.md in an issue/PR comment will usually not resolve to the repo file you expect. Use an absolute GitHub URL or a repo-root absolute path to the blob (or the special owner/repo/blob/branch path) instead.
Why and what to do:
Practical fixes:
Sources:
If you want, tell me the repo and path and Iβll produce the exact safe URL you should paste into your comment.
Set minimal explicit permissionsβgrant only
issues: writefor issues and onlypull-requests: writefor PRs, not both.You're using
pull_request_targetcorrectly (no checkout), but GitHub recommends scoping permissions to the narrowest set needed. Currently bothissues: writeandpull-requests: writeare granted together. Add apermissions:key to each event or split jobs if you prefer, but explicit scoping is the priorityβsplitting alone without scoped permissions does not reduce the attack surface.Upgrade and pin
actions/first-interactionto its commit SHA.The workflow uses
@v1(outdated; latest is v3.1.0). Pin to a full commit SHA instead of a tag, since tags are mutable and can move. For example:uses: actions/first-interaction@[commit-sha]with a comment noting the release version for future reference. This hardens the workflow against supply-chain drift.Use absolute repository URLs for
CONTRIBUTING.mdinstead of relative paths.Relative paths like
../CONTRIBUTING.mddo not resolve correctly in issue/PR comment bodies. Replace with the full GitHub blob URL:https://github.com/[OWNER]/[REPO]/blob/[BRANCH]/CONTRIBUTING.md.π€ Prompt for AI Agents