Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions dist/breaking-change.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
Thanks for your contribution :pray:

{{^release_candidate}}
This is now marked as a [`breaking-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-breaking-change) proposal to the Standard, this means that an old version of `publiccode.yml` won't be compatible with the new version.
{{/release_candidate}}
{{#release_candidate}}
This is now marked as a [`breaking-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-breaking-change) proposal to the Standard. This targets the upcoming **v1.0** on the `1.0-rc` branch.
{{/release_candidate}}

{{^release_candidate}}
Breaking changes can be released with a new major version at most once every two years, provided the current version of the Standard has been deprecating the object of this proposal for at least 6 months.

{{/release_candidate}}
Example of breaking changes are removal of keys or changes to key types.

The next eligible voting round will take place on **{{ next_vote_date }}**
Expand Down
5 changes: 5 additions & 0 deletions dist/bugfix-change.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
Thanks for your contribution :pray:

{{^release_candidate}}
This is now marked as a [`bugfix-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-bugfix-change),
this means that this change won't break any compatibility with the old versions of the Standard.
{{/release_candidate}}
{{#release_candidate}}
This is now marked as a [`bugfix-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-bugfix-change). This targets the upcoming **v1.0** on the `1.0-rc` branch.
{{/release_candidate}}

Example of bugfix changes are typo fixes.

Expand Down
5 changes: 5 additions & 0 deletions dist/deprecation-change.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
Thanks for your contribution :pray:

{{^release_candidate}}
This is now marked as a [`deprecation-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-deprecation), this means that this change won't break any compatibility with the old versions of the Standard,
and it will be possibile to make the definitive change 6 months after the deprecation with a new major release.
{{/release_candidate}}
{{#release_candidate}}
This is now marked as a [`deprecation-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-deprecation). This targets the upcoming **v1.0** on the `1.0-rc` branch.
{{/release_candidate}}

The next eligible voting round will take place on **{{ next_vote_date }}**

Expand Down
18 changes: 16 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8923,7 +8923,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.removeLabel = exports.addLabels = exports.setLabels = exports.commentToIssue = exports.reactToComment = exports.isChair = exports.isMaintainer = exports.inTeam = exports.getCommandsFromComment = void 0;
exports.removeLabel = exports.addLabels = exports.setLabels = exports.commentToIssue = exports.reactToComment = exports.hasLabel = exports.isChair = exports.isMaintainer = exports.inTeam = exports.getCommandsFromComment = void 0;
const fs_1 = __nccwpck_require__(7147);
const mustache_1 = __importDefault(__nccwpck_require__(8272));
const config_1 = __nccwpck_require__(6373);
Expand Down Expand Up @@ -8956,6 +8956,12 @@ function isChair(org, username) {
});
}
exports.isChair = isChair;
function hasLabel(context, name) {
var _a, _b;
const labels = ((_b = (_a = context.payload.issue) === null || _a === void 0 ? void 0 : _a.labels) !== null && _b !== void 0 ? _b : []);
return labels.some(label => label.name === name);
}
exports.hasLabel = hasLabel;
function reactToComment(context) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
Expand Down Expand Up @@ -8996,6 +9002,7 @@ function toMustacheView(context) {
steering_committee_team: config_1.STEERING_COMMITTEE_TEAM,
comment_author_username: (_c = (_b = (_a = context.payload.comment) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.login) !== null && _c !== void 0 ? _c : '',
next_vote_date: getNextVoteDate(),
release_candidate: hasLabel(context, 'v1'),
};
}
function commentToIssue(context, template, additionalVariables) {
Expand Down Expand Up @@ -9384,6 +9391,7 @@ function run(context) {
// eslint-disable-next-line prefer-template,no-path-concat
const template = (0, fs_1.readFileSync)(__nccwpck_require__.ab + "vote-end.md", 'utf8');
(0, bot_1.reactToComment)(context);
const isReleaseCandidate = (0, bot_1.hasLabel)(context, 'v1');
const { owner, repo, number } = context.issue;
const comments = yield octokit_1.default.paginate('GET /repos/:owner/:repo/issues/:issue_number/comments', { owner, repo, issue_number: number });
const voteComment = getBotComment(comments, '<!-- ##bot-voting-marker## -->');
Expand Down Expand Up @@ -9420,7 +9428,13 @@ function run(context) {
const voteResults = processResults(thumbsUps.map(t => t.user.login), thumbsDowns.map(t => t.user.login), !isAdditionalPeriod, approvingMember);
switch (+voteResults) {
case VoteResult.Approved:
resultMessage = `
resultMessage = isReleaseCandidate
? `
**Proposal approved** :+1:

This proposal will be merged into the \`1.0-rc\` branch and released later as part of v1.0.
`
: `
**Proposal approved** :+1:

This proposal is now ready to be merged and get released with a new version of the standard.
Expand Down
5 changes: 5 additions & 0 deletions dist/minor-change.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
Thanks for your contribution :pray:

{{^release_candidate}}
This is now marked as a [`minor-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-minor-change),
this means that old versions of `publiccode.yml` will still be valid with this change.
{{/release_candidate}}
{{#release_candidate}}
This is now marked as a [`minor-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-minor-change). This targets the upcoming **v1.0** on the `1.0-rc` branch.
{{/release_candidate}}

Example of minor changes are additions of new keys or making keys optional.

Expand Down
4 changes: 4 additions & 0 deletions dist/vote-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ The polls will stay open for {{ vote_period_days }} days, until **{{ vote_end_da

Leave a :+1: (thumbs up) **on this comment** to accept the proposal or a :-1: (thumbs down) to reject it.

{{#release_candidate}}
This proposal targets **v1.0**. If approved it will be merged into the `1.0-rc` branch and released later as part of v1.0, not immediately.

{{/release_candidate}}
cc @{{{ steering_committee_team }}}
24 changes: 24 additions & 0 deletions src/bot.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Context } from '@actions/github/lib/context';

import { hasLabel } from './bot';

function contextWithLabels(labels: unknown): Context {
return { payload: { issue: { labels } } } as unknown as Context;
}

test('hasLabel returns true when the label is present', () => {
const context = contextWithLabels([{ name: 'v1' }, { name: 'vote-start' }]);

expect(hasLabel(context, 'v1')).toBe(true);
});

test('hasLabel returns false when the label is absent', () => {
const context = contextWithLabels([{ name: 'vote-start' }]);

expect(hasLabel(context, 'v1')).toBe(false);
});

test('hasLabel returns false when there are no labels', () => {
expect(hasLabel(contextWithLabels([]), 'v1')).toBe(false);
expect(hasLabel({ payload: {} } as unknown as Context, 'v1')).toBe(false);
});
8 changes: 8 additions & 0 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface TemplateVariables {
bot_username: string;
comment_author_username: string;
next_vote_date: string;
release_candidate: boolean;
}

export interface Command {
Expand Down Expand Up @@ -51,6 +52,12 @@ export async function isChair(org: string, username: string) {
return inTeam(org, username, 'chair');
}

export function hasLabel(context: Context, name: LabelName): boolean {
const labels = (context.payload.issue?.labels ?? []) as Array<{ name?: string }>;

return labels.some(label => label.name === name);
}

export async function reactToComment(context: Context) {
const { owner: org, repo } = context.repo;

Expand Down Expand Up @@ -94,6 +101,7 @@ function toMustacheView(context: Context): TemplateVariables {
steering_committee_team: STEERING_COMMITTEE_TEAM,
comment_author_username: context.payload.comment?.user?.login ?? '',
next_vote_date: getNextVoteDate(),
release_candidate: hasLabel(context, 'v1'),
};
}

Expand Down
12 changes: 10 additions & 2 deletions src/commands/voteEnd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Context } from '@actions/github/lib/context';
import { GetResponseDataTypeFromEndpointMethod } from '@octokit/types';
import { BOT_USERNAME, MAINTAINERS_TEAM } from '../config';
import {
reactToComment, commentToIssue, addLabels, removeLabel,
reactToComment, commentToIssue, addLabels, removeLabel, hasLabel,
} from '../bot';
import { LabelName } from '../labels';
import octokit from '../octokit';
Expand Down Expand Up @@ -100,6 +100,8 @@ export default async function run(context: Context) {

reactToComment(context);

const isReleaseCandidate = hasLabel(context, 'v1');

const { owner, repo, number } = context.issue;

const comments = await octokit.paginate(
Expand Down Expand Up @@ -159,7 +161,13 @@ export default async function run(context: Context) {

switch (+voteResults) {
case VoteResult.Approved:
resultMessage = `
resultMessage = isReleaseCandidate
? `
**Proposal approved** :+1:

This proposal will be merged into the \`1.0-rc\` branch and released later as part of v1.0.
`
: `
**Proposal approved** :+1:

This proposal is now ready to be merged and get released with a new version of the standard.
Expand Down
1 change: 1 addition & 0 deletions src/labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type LabelName =
| 'standard-deprecation'
| 'standard-minor-change'
| 'standard-national-section'
| 'v1'
| 'vote-additional-period'
| 'vote-approved'
| 'vote-draft'
Expand Down
7 changes: 7 additions & 0 deletions src/templates/breaking-change.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
Thanks for your contribution :pray:

{{^release_candidate}}
This is now marked as a [`breaking-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-breaking-change) proposal to the Standard, this means that an old version of `publiccode.yml` won't be compatible with the new version.
{{/release_candidate}}
{{#release_candidate}}
This is now marked as a [`breaking-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-breaking-change) proposal to the Standard. This targets the upcoming **v1.0** on the `1.0-rc` branch.
{{/release_candidate}}

{{^release_candidate}}
Breaking changes can be released with a new major version at most once every two years, provided the current version of the Standard has been deprecating the object of this proposal for at least 6 months.

{{/release_candidate}}
Example of breaking changes are removal of keys or changes to key types.

The next eligible voting round will take place on **{{ next_vote_date }}**
Expand Down
5 changes: 5 additions & 0 deletions src/templates/bugfix-change.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
Thanks for your contribution :pray:

{{^release_candidate}}
This is now marked as a [`bugfix-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-bugfix-change),
this means that this change won't break any compatibility with the old versions of the Standard.
{{/release_candidate}}
{{#release_candidate}}
This is now marked as a [`bugfix-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-bugfix-change). This targets the upcoming **v1.0** on the `1.0-rc` branch.
{{/release_candidate}}

Example of bugfix changes are typo fixes.

Expand Down
5 changes: 5 additions & 0 deletions src/templates/deprecation-change.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
Thanks for your contribution :pray:

{{^release_candidate}}
This is now marked as a [`deprecation-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-deprecation), this means that this change won't break any compatibility with the old versions of the Standard,
and it will be possibile to make the definitive change 6 months after the deprecation with a new major release.
{{/release_candidate}}
{{#release_candidate}}
This is now marked as a [`deprecation-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-deprecation). This targets the upcoming **v1.0** on the `1.0-rc` branch.
{{/release_candidate}}

The next eligible voting round will take place on **{{ next_vote_date }}**

Expand Down
5 changes: 5 additions & 0 deletions src/templates/minor-change.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
Thanks for your contribution :pray:

{{^release_candidate}}
This is now marked as a [`minor-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-minor-change),
this means that old versions of `publiccode.yml` will still be valid with this change.
{{/release_candidate}}
{{#release_candidate}}
This is now marked as a [`minor-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-minor-change). This targets the upcoming **v1.0** on the `1.0-rc` branch.
{{/release_candidate}}

Example of minor changes are additions of new keys or making keys optional.

Expand Down
4 changes: 4 additions & 0 deletions src/templates/vote-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ The polls will stay open for {{ vote_period_days }} days, until **{{ vote_end_da

Leave a :+1: (thumbs up) **on this comment** to accept the proposal or a :-1: (thumbs down) to reject it.

{{#release_candidate}}
This proposal targets **v1.0**. If approved it will be merged into the `1.0-rc` branch and released later as part of v1.0, not immediately.

{{/release_candidate}}
cc @{{{ steering_committee_team }}}