Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
77e30ab5
Unverified
Commit
77e30ab5
authored
1 year ago
by
Aleksandr Lesnenko
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
auto assign PR authors and teams (#30455)
parent
5450d974
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.github/team.json
+48
-0
48 additions, 0 deletions
.github/team.json
.github/workflows/auto-assign.yml
+59
-0
59 additions, 0 deletions
.github/workflows/auto-assign.yml
with
107 additions
and
0 deletions
.github/team.json
0 → 100644
+
48
−
0
View file @
77e30ab5
{
"teams"
:
[
{
"name"
:
"App Viz"
,
"label"
:
".Team/Viz 📊"
,
"members"
:
[
"alxnddr"
,
"iethree"
,
"npfitz"
,
"EmmadUsmani"
,
"JesseSDevaney"
]
},
{
"name"
:
"Query Builder"
,
"label"
:
".Team/QueryBuilder 🧮"
,
"members"
:
[
"ranquild"
,
"WiNloSt"
,
"deniskaber"
,
"oisincoveney"
,
"uladzimirdev"
]
},
{
"name"
:
"App BE"
,
"label"
:
".Team/Backend 🥞"
,
"members"
:
[
"dpsutton"
,
"tsmacdonald"
,
"qnkhuat"
,
"calherries"
]
},
{
"name"
:
"Query Processor"
,
"label"
:
".Team/QueryProcessor 🛠️"
,
"members"
:
[
"camsaul"
,
"kulyk"
,
"snoe"
,
"bshepherdson"
,
"john-metabase"
,
"metamben"
]
},
{
"name"
:
"Fun Police"
,
"label"
:
".Team/FunPolice 👮"
,
"members"
:
[
"noahmoss"
,
"escherize"
,
"adam-james-v"
]
}
]
}
This diff is collapsed.
Click to expand it.
.github/workflows/auto-assign.yml
0 → 100644
+
59
−
0
View file @
77e30ab5
name
:
Auto assign pull requests
on
:
pull_request
:
types
:
-
opened
jobs
:
update_pr
:
runs-on
:
ubuntu-latest
steps
:
-
uses
:
tibdex/github-app-token@v1.6.0
id
:
generate-token
with
:
app_id
:
${{ secrets.METABASE_BOT_APP_ID }}
private_key
:
${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
-
name
:
Checkout repository
uses
:
actions/checkout@v3
-
name
:
Assign author and their team. Returns
true
if team exists.
id
:
auto-assign
uses
:
actions/github-script@v6
with
:
github-token
:
${{ steps.generate-token.outputs.token }}
script
:
|
const fs = require('fs');
const teamConfig = JSON.parse(fs.readFileSync('.github/team.json', 'utf-8'));
const prAuthor = context.payload.pull_request.user.login;
const prNumber = context.payload.pull_request.number;
// Assign PR author
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
assignees: [prAuthor]
});
const team = teamConfig.teams.find(t => t.members.includes(prAuthor));
if (!team) {
console.log('You are not assigned to any team. If you need one, update .github/team.json');
return false;
}
// Add team label
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
labels: [team.label]
});
return true;
-
uses
:
actions/add-to-project@v0.5.0
if
:
${{ fromJSON(steps.auto-assign.outputs.result) }}
with
:
project-url
:
https://github.com/orgs/metabase/projects/50/views/1
github-token
:
${{ steps.generate-token.outputs.token }}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment