Skip to content
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

Improve project management #674

Merged
merged 7 commits into from
Jan 25, 2024
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: 3 additions & 4 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Report a bug
name: Bug
description: |
Create a bug report to help us improve Zenoh.
title: "[Bug] "
Report a bug.
labels: ["bug"]
body:
- type: textarea
Expand All @@ -19,7 +18,7 @@ body:
attributes:
label: To reproduce
description: "Steps to reproduce the behavior:"
placeholder: |
placeholder: |
1. Start a subscriber "..."
2. Start a publisher "...."
3. See error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Request a feature
name: New feature
description: |
Suggest a new feature specific to this repository. NOTE: for generic Zenoh ideas use "Ask a question".
Suggest a new feature.
labels: ["new feature"]
body:
- type: markdown
attributes:
Expand Down
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Add an issue to the next release
description: |
Add an issue as part of next release.
This will be added to the current release project.
You must be a contributor to use this template.
labels: ["release"]
body:
- type: markdown
attributes:
value: |
**Guidelines for a good issue**

*Is your release item related to a problem?*
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

*Describe the solution you'd like*
A clear and concise description of what you want to happen.

*Describe alternatives you've considered*
A clear and concise description of any alternative solutions or features you've considered.

*Additional context*
Add any other context about the release item request here.
- type: textarea
id: item
attributes:
label: "Describe the release item"
validations:
required: true
63 changes: 63 additions & 0 deletions .github/workflows/enforce-linking-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Enforce linking issues to pull requests

on:
pull_request:
types: [opened, edited, labeled]
workflow_call:

defaults:
run:
shell: bash

jobs:
main:
name: Check if the pull request has a linked issue
runs-on: ubuntu-latest
steps:
- name: Count closing issue references
id: has-closing-issue
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const query = `query ($owner: String!, $name: String!, $number: Int!) {
repository(owner: $owner, name: $name) {
pullRequest(number: $number) {
closingIssuesReferences(first: 100) {
totalCount
}
}
}
}`;

const reply = await github.graphql(query, {
owner: context.repo.owner,
name: context.repo.repo,
number: context.payload.pull_request.number
});

return reply
.repository
.pullRequest
.closingIssuesReferences
.totalCount > 0;

- if: ${{ steps.has-closing-issue.outputs.result != 'true' }}
name: Suggest that the contributor link an issue
uses: actions/github-script@v7
with:
github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }}
script: |
const login = "${{ github.event.pull_request.user.login }}";
const syntaxUrl = "https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue";
const message = `@${login} Please consider linking this pull request to an issue using \`Closes #ISSUE-NUMBER\` [syntax](syntaxUrl), \
especially if this pull request contains a bugfix, an enchancement or a new feature.`;

github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: message,
});

core.setFailed("This pull request has no linked issue")
76 changes: 76 additions & 0 deletions .github/workflows/update-release-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Add relevant issues to the release project

on:
issues:
types: [opened, edited, labeled]
workflow_call:

defaults:
run:
shell: bash

jobs:
main:
name: Add issue to the release project
runs-on: ubuntu-latest
steps:
- name: Get the latest release project
id: get-project-url
uses: actions/github-script@v7
with:
github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }}
result-encoding: string
script: |
const query = `query ($login: String!) {
organization(login: $login) {
projectsV2(first: 100, orderBy: {direction: DESC, field: NUMBER}) {
nodes {
title
url
}
}
}
}`;

const projects = await github.graphql(query, {
login: context.repo.owner
});

const result = projects
.organization
.projectsV2
.nodes
.find(p => /zenoh [\w\.\-\+]+ release/i.test(p.title))
.url;

core.info(`Using release project ${result}`)
return result;

- name: Is the issue author a contributor?
id: author-is-contributor
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const contributors = github.rest.repos.listContributors({
owner: context.repo.owner,
repo: context.repo.repo,
});

const login = "${{ github.event.issue.user.login }}";

const result = contributors
.data
.map(c => c.login)
.includes(login);

core.info(`Is the issue author ${login} a contributor? ${result}`);
return result;

- if: ${{ steps.author-is-contributor.outputs.result == 'true' }}
name: Add issue to the release project if it has a release label
uses: actions/[email protected]
with:
github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }}
project-url: ${{ steps.get-project-url.outputs.result }}
labeled: release