From 4bfd4b1a124aaa35ec4c18999497e761a0f20025 Mon Sep 17 00:00:00 2001 From: peteGSX <97784652+peteGSX@users.noreply.github.com> Date: Thu, 27 Oct 2022 09:34:13 +1000 Subject: [PATCH] Add templates and project workflow (#258) * Add templates and project workflow * Fixed template typos --- .github/ISSUE_TEMPLATE/bug_report.yml | 80 ++++++++++ .github/ISSUE_TEMPLATE/config.yml | 12 ++ .../ISSUE_TEMPLATE/documentation_update.yml | 31 ++++ .github/ISSUE_TEMPLATE/feature_request.yml | 37 +++++ .github/ISSUE_TEMPLATE/support_request.yml | 39 +++++ .github/ISSUE_TEMPLATE/to_do.yml | 24 +++ .github/workflows/new-items.yml | 143 ++++++++++++++++++ 7 files changed, 366 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/documentation_update.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/ISSUE_TEMPLATE/support_request.yml create mode 100644 .github/ISSUE_TEMPLATE/to_do.yml create mode 100644 .github/workflows/new-items.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..457a075 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,80 @@ +# Bug report GitHub issue form +# +# This file needs to reside in the ".github/ISSUE_TEMPLATE/" folder. + +name: Bug Report +description: Submit a bug report +labels: + - Bug +title: "Bug Report: " +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to submit a bug report to the DCC-EX team! + + In order to help us to validate the bug and ascertain what's causing it, please provide as much information as possible in this form. + + - type: input + id: version + attributes: + label: Version + description: Please provide the version of EX-CommandStation in use. + validations: + required: true + + - type: textarea + id: description + attributes: + label: Bug description + description: Please provide a clear and concise description of what the symptoms of the bug are. + placeholder: | + When attempting to drive a locomotive on the main track, it runs forwards, backwards, spins around, jumps up and down, blows the horn, and then stops. + validations: + required: true + + - type: textarea + id: reproduction + attributes: + label: Steps to reproduce the bug + description: Please provide the steps to reproduce the behaviour. + placeholder: | + 1. Turn on the CommandStation and track power. + 2. Connect Engine Driver to the CommandStation. + 3. Select locomotive with address 123. + 4. Throttle up to half speed. + validations: + required: true + + - type: textarea + id: expectation + attributes: + label: Expected behaviour + description: Please provide a clear and concise description of what you expected to happen. + placeholder: | + The locomotive should accelerate smoothly to half speed in a forward direction. + validations: + required: true + + - type: textarea + id: screenshots + attributes: + label: Screenshots + description: If applicable, upload any screenshots here. + + - type: textarea + id: hardware + attributes: + label: Hardware in use + description: Please provide details of hardware in use including microcontroller, motor shield, and any other relevant information. + placeholder: | + Elegoo Mega2560 + Arduino R3 motor shield + validations: + required: true + + - type: textarea + id: extra-context + attributes: + label: Additional context + description: Please provide any other relevant information that could help us resolve this issue, for example a customised config.h file. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..21c2243 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,12 @@ +# Configuration file for the template chooser +# +# This file needs to exist in the https://github.com/DCC-EX/.github repository in the ".github/ISSUE_TEMPLATE/" folder. + +blank_issues_enabled: false +contact_links: + - name: DCC-EX Discord server + url: https://discord.gg/y2sB4Fp + about: For the best support experience, join our Discord server + - name: DCC-EX Contact and Support page + url: https://dcc-ex.com/support/index.html + about: For other support options, refer to our Contact & Support page \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/documentation_update.yml b/.github/ISSUE_TEMPLATE/documentation_update.yml new file mode 100644 index 0000000..2fc9405 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation_update.yml @@ -0,0 +1,31 @@ +# Documentation update GitHub issue form +# +# This file needs to reside in the ".github/ISSUE_TEMPLATE/" folder. + +name: Documentation Update +description: Submit a request for documentation updates, or to report broken links or inaccuracies +title: "[Documentation Update]: " +labels: + - Needs Documentation +body: + - type: markdown + attributes: + value: | + Use this template to submit a request for updates to our documentation. + + This can be used for general documentation requests if information is missing or lacking, or to correct issues with our existing documentation such as broken links, or inaccurate information. + + - type: textarea + id: details + attributes: + label: Documentation details + description: Provide the details of what needs to be documented or corrected. + validations: + required: true + + - type: input + id: page + attributes: + label: Page with issues + description: If reporting broken links or inaccuracies, please provide the link to the page here. + placeholder: https://dcc-ex.com/index.html \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..c1fae16 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,37 @@ +# Feature Request GitHub issue form +# +# This file needs to reside in the ".github/ISSUE_TEMPLATE/" folder. + +name: Feature Request +description: Suggest a new feature +title: "[Feature Request]: " +labels: + - Enhancement +body: + - type: markdown + attributes: + value: | + Use this template to suggest a new feature for EX-CommandStation. + + - type: textarea + id: description + attributes: + label: Problem/idea statement + description: Please provide the problem you're trying to solve, or share the idea you have. + placeholder: A clear and concise description of the problem you're trying to solve, or the idea you have. For example, I'm always frustrated when... + validations: + required: true + + - type: textarea + id: alternatives + attributes: + label: Alternatives or workarounds + description: Please provide any alternatives or workarounds you currently use. + validations: + required: true + + - type: textarea + id: context + attributes: + label: Additional context + description: Add any other context, screenshots, or files related to the feature request here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/support_request.yml b/.github/ISSUE_TEMPLATE/support_request.yml new file mode 100644 index 0000000..c53d2b7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/support_request.yml @@ -0,0 +1,39 @@ +# Support Request GitHub issue form +# +# This file needs to reside in the ".github/ISSUE_TEMPLATE/" folder. + +name: Support Request +description: Request support or assistance +title: "[Support Request]: " +labels: + - Support Request +body: + - type: markdown + attributes: + value: | + Use this template to request support or assistance with EX-CommandStation. + + - type: input + id: version + attributes: + label: Version + description: Please provide the version of the software in use. + validations: + required: true + + - type: textarea + id: description + attributes: + label: Issue description + description: Please describe the issue being encountered as accurately and detailed as possible. + validations: + required: true + + - type: textarea + id: hardware + attributes: + label: Hardware + description: If appropriate, please provide details of the hardware in use. + placeholder: | + Elegoo Mega2560 + Arduino Motor Shield R3 \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/to_do.yml b/.github/ISSUE_TEMPLATE/to_do.yml new file mode 100644 index 0000000..2905b8c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/to_do.yml @@ -0,0 +1,24 @@ +# General To Do item GitHub issue form +# +# This file needs to reside in the ".github/ISSUE_TEMPLATE/" folder. + +name: To Do +description: Create a general To Do item +title: "[To Do]: " +labels: + - To Do +body: + - type: markdown + attributes: + value: | + Use this template to create an issue for a general task that needs to be done. + + This is handy for capturing ad-hoc items that don't necessarily require code to be written or updated. + + - type: textarea + id: description + attributes: + label: Task description + description: Provide the details of what needs to be done. + validations: + required: true \ No newline at end of file diff --git a/.github/workflows/new-items.yml b/.github/workflows/new-items.yml new file mode 100644 index 0000000..b5f0a48 --- /dev/null +++ b/.github/workflows/new-items.yml @@ -0,0 +1,143 @@ +# This workflow is to be used for all repositories to integrate with the DCC++ EX Beta Project. +# It will add all issues and pull requests for a repository to the project, and put in the correct status. +# +# Ensure "REPO_LABEL" is updated with the correct label for the repo stream of work. +name: Add Issue or Pull Request to Project + +env: + REPO_LABEL: ${{ secrets.PROJECT_STREAM_LABEL }} + PROJECT_NUMBER: 7 + ORG: DCC-EX + +on: + issues: + types: + - opened + pull_request: + types: + - ready_for_review + - opened + - review_requested + +jobs: + add_to_project: + runs-on: ubuntu-latest + steps: + - name: Add labels + uses: andymckay/labeler@master + with: + add-labels: ${{ env.REPO_LABEL }} + + - name: Generate token + id: generate_token + uses: tibdex/github-app-token@36464acb844fc53b9b8b2401da68844f6b05ebb0 + with: + app_id: ${{ secrets.PROJECT_APP_ID }} + private_key: ${{ secrets. PROJECT_APP_KEY }} + + - name: Get project data + env: + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} + run: | + gh api graphql -f query=' + query($org: String!, $number: Int!) { + organization(login: $org){ + projectNext(number: $number) { + id + fields(first:20) { + nodes { + id + name + settings + } + } + } + } + }' -f org=$ORG -F number=$PROJECT_NUMBER > project_data.json + + echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV + echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV + echo 'BACKLOG_OPTION_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="Backlog") |.id' project_data.json) >> $GITHUB_ENV + echo 'TO_DO_OPTION_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="To Do") |.id' project_data.json) >> $GITHUB_ENV + echo 'NEEDS_REVIEW_OPTION_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="Needs Review") |.id' project_data.json) >> $GITHUB_ENV + echo 'IN_PROGRESS_OPTION_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="In Progress") |.id' project_data.json) >> $GITHUB_ENV + + - name: Add issue to project + env: + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} + ITEM_ID: ${{ github.event.issue.node_id }} + if: github.event_name == 'issues' + run: | + project_item_id="$( gh api graphql -f query=' + mutation($project:ID!, $item:ID!) { + addProjectNextItem(input: {projectId: $project, contentId: $item}) { + projectNextItem { + id + } + } + }' -f project=$PROJECT_ID -f item=$ITEM_ID --jq '.data.addProjectNextItem.projectNextItem.id')" + echo 'PROJECT_ITEM_ID='$project_item_id >> $GITHUB_ENV + + - name: Add PR to project + env: + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} + ITEM_ID: ${{ github.event.pull_request.node_id }} + if: github.event_name == 'pull_request' + run: | + project_item_id="$( gh api graphql -f query=' + mutation($project:ID!, $item:ID!) { + addProjectNextItem(input: {projectId: $project, contentId: $item}) { + projectNextItem { + id + } + } + }' -f project=$PROJECT_ID -f item=$ITEM_ID --jq '.data.addProjectNextItem.projectNextItem.id')" + echo 'PROJECT_ITEM_ID='$project_item_id >> $GITHUB_ENV + + - name: Set status - To Do + env: + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} + if: github.event_name == 'issues' && (contains(github.event.*.labels.*.name, 'Bug') || contains(github.event.*.labels.*.name, 'Support Request')) + run: | + gh api graphql -f query=' + mutation( + $project: ID! + $item: ID! + $status_field: ID! + $status_value: String! + ){ + set_status: updateProjectNextItemField(input: { + projectId: $project + itemId: $item + fieldId: $status_field + value: $status_value + }) { + projectNextItem { + id + } + } + }' -f project=$PROJECT_ID -f item=$PROJECT_ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=${{ env.TO_DO_OPTION_ID }} --silent + + - name: Set status - Review + env: + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} + if: github.event_name == 'issues' && (contains(github.event.*.labels.*.name, 'Unit Tested') || contains(github.event.*.labels.*.name, 'Regression Tested') || contains(github.event.*.labels.*.name, 'Needs Review')) || github.event_name == 'pull_request' + run: | + gh api graphql -f query=' + mutation( + $project: ID! + $item: ID! + $status_field: ID! + $status_value: String! + ){ + set_status: updateProjectNextItemField(input: { + projectId: $project + itemId: $item + fieldId: $status_field + value: $status_value + }) { + projectNextItem { + id + } + } + }' -f project=$PROJECT_ID -f item=$PROJECT_ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=${{ env.NEEDS_REVIEW_OPTION_ID }} --silent