Skip to content

Commit

Permalink
Improve project management (#674)
Browse files Browse the repository at this point in the history
* fix: Remove redudant phrase in issue template desc

* feat: Expand issue templates

* feat: Add update-release-project workflow

* feat: Add enforce-linking-issues workflow

* fix: Typo (TOKEN_BOT_WORKFLOW -> BOT_TOKEN_WORKFLOW)

* fix: Language edits

* fix: Use one generic release item template
  • Loading branch information
fuzzypixelz authored Jan 25, 2024
1 parent 4f03fc7 commit eddf371
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 6 deletions.
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

0 comments on commit eddf371

Please sign in to comment.