Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit c9925e3

Browse files
committed
Merge remote-tracking branch 'origin/master' into aw/fr/blank-slate
2 parents 76571cd + b8aa3b8 commit c9925e3

File tree

260 files changed

+21041
-6613
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

260 files changed

+21041
-6613
lines changed

.github/main.workflow

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
workflow "GraphQL schema update" {
2+
// Every Thursday at 1am.
3+
on = "schedule(0 1 * * 4)"
4+
resolves = "Update schema"
5+
}
6+
7+
workflow "Core team issues" {
8+
on = "issues"
9+
resolves = "Add issue to release board"
10+
}
11+
12+
workflow "Core team pull requests" {
13+
on = "pull_request"
14+
resolves = "Add pull request to release board"
15+
}
16+
17+
action "Update schema" {
18+
uses = "./actions/schema-up"
19+
secrets = ["GITHUB_TOKEN"]
20+
}
21+
22+
action "Consider issue for release board" {
23+
uses = "actions/bin/filter@master"
24+
args = "action assigned"
25+
}
26+
27+
action "Add issue to release board" {
28+
needs = "Consider issue for release board"
29+
uses = "./actions/auto-sprint"
30+
secrets = ["GITHUB_TOKEN"]
31+
}
32+
33+
action "Consider pull request for release board" {
34+
uses = "actions/bin/filter@master"
35+
args = "action 'opened|merged|assigned|reopened'"
36+
}
37+
38+
action "Add pull request to release board" {
39+
needs = "Consider pull request for release board"
40+
uses = "./actions/auto-sprint"
41+
secrets = ["GRAPHQL_TOKEN"]
42+
}

actions/auto-sprint/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM node:8-slim
2+
3+
LABEL "com.github.actions.name"="auto-sprint"
4+
LABEL "com.github.actions.description"="Add opened pull requests and assigned issues to the current sprint project"
5+
LABEL "com.github.actions.icon"="list"
6+
LABEL "com.github.actions.color"="white"
7+
8+
# Copy the package.json and package-lock.json
9+
COPY package*.json ./
10+
11+
# Install dependencies
12+
RUN npm ci
13+
14+
# Copy the rest of your action's code
15+
COPY . /
16+
17+
# Run `node /index.js`
18+
ENTRYPOINT ["node", "/index.js"]

actions/auto-sprint/index.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
const {Toolkit} = require('actions-toolkit');
2+
const {withDefaults} = require('actions-toolkit/lib/graphql');
3+
4+
Toolkit.run(async tools => {
5+
// Re-authenticate with the correct secret.
6+
tools.github.graphql = withDefaults(process.env.GRAPHQL_TOKEN);
7+
8+
// Ensure that the actor of the triggering action belongs to the core team
9+
const actorLogin = tools.context.actor;
10+
const teamResponse = await tools.github.graphql(`
11+
query {
12+
organization(login: "atom") {
13+
team(slug: "github-package") {
14+
members(first: 100) {
15+
nodes {
16+
login
17+
}
18+
}
19+
}
20+
}
21+
}
22+
`);
23+
if (!teamResponse.organization.team.members.nodes.some(node => node.login === actorLogin)) {
24+
tools.exit.neutral('User %s is not in the github-package team. Thanks for your contribution!', actorLogin);
25+
}
26+
27+
// Identify the active release board and its "In progress" column
28+
const projectQuery = await tools.github.graphql(`
29+
query {
30+
repository(owner: "atom", name: "github") {
31+
projects(
32+
search: "Release"
33+
states: [OPEN]
34+
first: 1
35+
orderBy: {field: CREATED_AT, direction: DESC}
36+
) {
37+
nodes {
38+
id
39+
name
40+
41+
columns(first: 10) {
42+
nodes {
43+
id
44+
name
45+
}
46+
}
47+
}
48+
}
49+
}
50+
}
51+
`);
52+
const project = projectQuery.repository.projects.nodes[0];
53+
if (!project) {
54+
tools.exit.failure('No open project found with a name matching "Release".');
55+
}
56+
const column = project.columns.nodes.find(node => node.name === 'In progress');
57+
if (!column) {
58+
tools.exit.failure('No column found in the project %s with a name of exactly "In progress".', project.name);
59+
}
60+
61+
// Add the issue/pull request to the sprint board
62+
await tools.github.graphql(`
63+
mutation ProjectCardAddition($columnID: ID!, $issueishID: ID!) {
64+
addProjectCard(input: {projectColumnId: $columnID, contentId: $issueishID}) {
65+
clientMutationId
66+
}
67+
}
68+
`, {
69+
columnID: column.id,
70+
issueishID: tools.context.event === 'issues'
71+
? tools.context.payload.issue.node_id
72+
: tools.context.payload.pull_request.node_id,
73+
});
74+
tools.exit.success('Added as a project card.');
75+
}, {
76+
event: [
77+
'issues.assigned',
78+
'pull_request.opened',
79+
'pull_request.merged',
80+
'pull_request.assigned',
81+
'pull_request.reopened',
82+
],
83+
secrets: ['GRAPHQL_TOKEN'],
84+
});

0 commit comments

Comments
 (0)