-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
4f03fc7
commit eddf371
Showing
5 changed files
with
174 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
.github/ISSUE_TEMPLATE/feature_request.yml → .github/ISSUE_TEMPLATE/new_feature.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |