Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
graphify/.github/workflows/pr-management.yml at v8 · Graphify-Labs/graphify · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Graphify-Labs
graphify
Repository navigation
Code
Issues
712
(712)
Pull requests
877
(877)
Discussions
Actions
Projects
Security and quality
1
(1)
Insights
More
items
Files
Expand file tree
v8
Breadcrumbs
graphify
/
.github
/
workflows
/
pr-management.yml
Copy path
View runs
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
134 lines (119 loc) · 5.16 KB
v8
Breadcrumbs
graphify
/
.github
/
workflows
/
pr-management.yml
Copy path
Top
File metadata and controls
Code
Blame
134 lines (119 loc) · 5.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name
:
PR management
#
Two lightweight, no-build jobs that run only on PR metadata (never on PR code),
#
mirroring practices from larger OSS projects:
#
* contributor-label: tag a PR from a returning community contributor so
#
maintainers can see community work at a glance.
#
* pr-standards: nudge PR titles toward the conventional-commit format the
#
changelog and release notes are built from (non-blocking; comment + label).
#
Both skip maintainers listed in .github/TEAM_MEMBERS and all bots.
#
pull_request_target is used so the token can label/comment on PRs from forks;
#
neither job checks out or executes PR code, so this is safe.
on
:
pull_request_target
:
types
:
[opened, edited, synchronize]
permissions
:
pull-requests
:
write
issues
:
write
jobs
:
contributor-label
:
#
Only needs to run once, when the PR is opened.
if
:
github.event.action == 'opened'
runs-on
:
ubuntu-latest
steps
:
-
uses
:
actions/github-script@v7
with
:
script
:
|
const pr = context.payload.pull_request;
const login = pr.user.login;
if (login.endsWith('[bot]')) return;
// author_association is CONTRIBUTOR only once a prior commit by this
// user has landed in the repo (our authorship-preserving cherry-picks
// count), so this flags returning community contributors and never a
// first-PR author or a maintainer (who reports MEMBER / OWNER).
if (pr.author_association !== 'CONTRIBUTOR') return;
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels: ['contributor'],
});
pr-standards
:
runs-on
:
ubuntu-latest
steps
:
-
uses
:
actions/github-script@v7
with
:
script
:
|
const pr = context.payload.pull_request;
const login = pr.user.login;
if (login.endsWith('[bot]')) return;
// Exempt maintainers listed in .github/TEAM_MEMBERS (read from the
// base repo, never from the PR branch).
let members = [];
try {
const { data: file } = await github.rest.repos.getContent({
owner: context.repo.owner,
repo: context.repo.repo,
path: '.github/TEAM_MEMBERS',
});
members = Buffer.from(file.content, 'base64')
.toString()
.split('\n')
.map((l) => l.trim())
.filter(Boolean);
} catch (e) {
// No TEAM_MEMBERS file: treat everyone as a community contributor.
}
if (members.includes(login)) return;
const LABEL = 'needs:title';
const MARKER = '<!-- pr-standards:title -->';
// feat:, fix(scope):, docs (scope):, chore!: ... (conventional commits)
const titleOk = /^(feat|fix|docs|chore|refactor|test|perf|build|ci|style|revert)(\([a-zA-Z0-9 _-]+\))?!?:\s+\S/.test(
pr.title,
);
async function hasLabel() {
const { data } = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
});
return data.some((l) => l.name === LABEL);
}
if (titleOk) {
if (await hasLabel()) {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
name: LABEL,
}).catch(() => {});
}
return;
}
// Non-conforming title: label it and post one gentle, non-blocking note.
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels: [LABEL],
});
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
});
if (comments.some((c) => c.body && c.body.includes(MARKER))) return;
const body =
MARKER +
'\n' +
`Thanks @${login}! One small thing: our changelog and release notes are ` +
'built from PR titles, so we use the [conventional-commits](https://www.conventionalcommits.org) ' +
'format, for example:\n\n' +
'```\nfix(python): resolve a bare stdlib import correctly\n```\n\n' +
'Prefixes we use: `feat`, `fix`, `docs`, `chore`, `refactor`, `test`, `perf`, `build`, `ci`. ' +
'Editing the PR title clears this automatically. This is just a nudge and does not block review.';
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body,
});
You can’t perform that action at this time.