Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from digicatapult/feature/template-repo-contents
Browse files Browse the repository at this point in the history
Feature/template repo contents
  • Loading branch information
darrylmorton-digicatapult authored Jan 6, 2022
2 parents fd9d451 + 76d207a commit 8a4eef4
Show file tree
Hide file tree
Showing 42 changed files with 12,773 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.github
.nyc_output
coverage
node_modules
scripts
test

.eslintignore
.eslintrc
.nycrc
.prettierrc
*.md
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
package.json
coverage
.nyc_output
27 changes: 27 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"extends": ["eslint:recommended", "prettier"],
"plugins": ["prettier"],
"env": {
"es6": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module"
},
"rules": {
"prettier/prettier": "error",
"no-console": 2
},
"overrides": [
{
"files": ["**/test/**/*.test.js"],
"rules": {
"prettier/prettier": "error"
},
"env": {
"mocha": true
}
}
]
}
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Github CODEOWNERS file

# Default code-owners for this repository
* @mattdean-digicatapult @darrylmorton-digicatapult @dblane-digicatapult @jonmattgray
46 changes: 46 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Bug report
about: Create a report to help us improve
---

<!--
Have you read VITALam's Code of Conduct? By filing an Issue, you are expected to comply with it, including treating everyone with respect: https://github.com/digicatapult/vitalam-service-template/.github/blob/main/CODE_OF_CONDUCT.md
-->

### Prerequisites

- [ ] Put an X between the brackets on this line if you have done all of the following:
- Checked the FAQs for common solutions: <https://github.com/digicatapult/vitalam-service-template/blob/main/CONTRIBUTING.md/#FAQs>
- Checked that your issue isn't already filed: <https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Avitalam-service-template>

### Description

<!-- Description of the issue -->

### Steps to Reproduce

1. <!-- First Step -->
2. <!-- Second Step -->
3. <!-- and so on… -->

**Expected behaviour:**

<!-- What you expect to happen -->

**Actual behaviour:**

<!-- What actually happens -->

**Reproduces how often:**

<!-- What percentage of the time does it reproduce? -->

### Versions

<!-- You can get this information from copy and pasting the version on the home page or via package.json. Also, please include the OS and what version of the OS you're running. -->

### Additional Information

<!-- Any additional information, configuration or data that might be necessary to reproduce the issue. -->
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Feature request
about: Suggest an idea for this project
---

<!--
Have you read VITALam's Code of Conduct? By filing an Issue, you are expected to comply with it, including treating everyone with respect: https://github.com/digicatapult/vitalam-service-template/.github/blob/main/CODE_OF_CONDUCT.md
---
Also note that the Digital Catapult team has finite resources so it's unlikely that we'll work on feature requests. If we're interested in a particular feature however, we'll follow up and ask you to submit an RFC to talk about it in more detail.
-->

## Summary

<!-- One paragraph explanation of the feature. -->

## Motivation

<!-- Why are we doing this? What use cases does it support? What is the expected outcome? -->

## Describe alternatives you've considered

<!-- A clear and concise description of the alternative solutions you've considered. Be sure to explain why VITALam's existing customisability isn't suitable for this feature. -->

## Additional context

<!-- Add any other context or screenshots about the feature request here. -->
10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
⚛👋 Hello there! Welcome. Please follow the steps below to tell us about your contribution.

1. Copy the correct template for your contribution

- 🐛 Are you fixing a bug? Copy the template from <https://github.com/digicatapult/vitalam-service-template/blob/main/.github/ISSUE_TEMPLATE/bug_report.md>
- 💻 Are you changing functionality? Copy the template from <https://github.com/digicatapult/vitalam-service-template/blob/main/.github/ISSUE_TEMPLATE/feature_request.md>

2. Replace this text with the contents of the template
3. Fill in all sections of the template
4. Click "Create pull request"
73 changes: 73 additions & 0 deletions .github/workflows/apply-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Apply Template

on:
push:
branches: ["main"]

jobs:
repo_ids:
name: Get Repository Name
runs-on: ubuntu-latest
outputs:
is_renamed: ${{ steps.check_rename_occurred.outputs.IS_RENAMED }}
repo_name: ${{ steps.check_rename_occurred.outputs.REPO_NAME }}
org_name: ${{ steps.check_rename_occurred.outputs.ORG_NAME }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check if rename has occurred
id: check_rename_occurred
run: |
LINES=$(grep vitalam-service-template ./package.json)
if [ -z "$LINES" ]; then
echo "::set-output name=IS_RENAMED::true"
else
echo "::set-output name=IS_RENAMED::false"
fi
REPO_NAME=$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]')
ORG_NAME=$(echo "${{ github.event.repository.owner.name }}" | tr '[:upper:]' '[:lower:]')
echo "::set-output name=REPO_NAME::$REPO_NAME"
echo "::set-output name=ORG_NAME::$ORG_NAME"
update-repo:
name: Update repository references
runs-on: ubuntu-latest
needs: [repo_ids]
if: ${{ github.event.repository.name != 'vitalam-service-template' && needs.repo_ids.outputs.is_renamed == 'false' }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install yq
run: sudo snap install yq
- name: Reset versioning
run: |
npm version 0.0.1 --allow-same-version --no-git-tag-version
yq eval -i '.version |= "0.0.1"' ./helm/vitalam-service-template/Chart.yaml
yq eval -i '.appVersion |= "0.0.1"' ./helm/vitalam-service-template/Chart.yaml
yq eval -i '.image.tag |= "v0.0.1"' ./helm/vitalam-service-template/values.yaml
- name: Update repo name references
run: |
find . \( -path ./.git -prune -o -path ./.github/workflows -prune \) -type f -o -name '*' -exec sed -i 's/vitalam-service-template/${{ needs.repo_ids.outputs.repo_name }}/gI' {} \;
find . \( -path ./.git -prune -o -path ./.github/workflows -prune \) -type f -o -name '*' -exec sed -i 's/digicatapult/${{ needs.repo_ids.outputs.org_name }}/gI' {} \;
- name: Rename Helm Directory
run: mv ./helm/vitalam-service-template ./helm/${{ needs.repo_ids.outputs.repo_name }}
- name: Remove template workflow
run: rm ./.github/workflows/apply-template.yml
- name: Set Git Config
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Commit changes
run: |
git add -A
git commit -m "Apply templating to ${{ needs.repo_ids.outputs.repo_name }}"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
branch: bot/apply-template
base: main
title: Apply template
body: Automated pull request to apply repository template changes
assignees: ${{ github.actor }}
reviewers: ${{ github.actor }}
Loading

0 comments on commit 8a4eef4

Please sign in to comment.