Skip to content

Commit

Permalink
🔀 Merge pull request #212 from Lissy93/CI/repo-management-actions
Browse files Browse the repository at this point in the history
[CI] GH Actions for Repo Management
  • Loading branch information
Lissy93 authored Sep 9, 2021
2 parents f14d1ce + bb88815 commit 28a1a57
Show file tree
Hide file tree
Showing 23 changed files with 506 additions and 78 deletions.
7 changes: 7 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 👷 1.7.3 - CI with GH Actions [PR #212](https://github.com/Lissy93/dashy/pull/212)
- Adds a series of GH actions for repository maintenance and administration
- Auto-labels PR and issues, adds helpful info to PRs based on files changed
- Lints, tests, builds and deploys the app when PR submitted
- Checks app size, dependencies, security, accessibility etc when PR submitted
- Closes incomplete, stale or spammy issues and leaves a comment

## ✨ 1.7.2 - Item Sort Options [PR #203](https://github.com/Lissy93/dashy/pull/203)
- Adds option for user to specify `sortBy` to order items within a section
- Can sort by last clicked, most used, alphabetically and more
Expand Down
15 changes: 15 additions & 0 deletions .github/issue-auto-comments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
comment:
header: Hello 👋
footer: |
---
> I am a bot, and this is an automated message 🤖
labels:
- name: invalid
labeled:
issue:
body: Please follow the issue templates.
action: close
pr:
body: Thank you @{{ pull_request.user.login }} for suggesting this. Please follow the pull request templates.
action: close

24 changes: 24 additions & 0 deletions .github/issue-report-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[
{
"section": "Feature Requests",
"labels": [
"🦄 Feature Request"
],
"threshold": 100
},
{
"section": "Bugs",
"labels": [
"🐛 Bug"
],
"threshold": 100
},
{
"section": "Questions & Feedback",
"labels": [
"🤷‍♂️ Question",
"🌈 Feedback"
],
"threshold": 100
}
]
94 changes: 89 additions & 5 deletions .github/pr-auto-comments.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,101 @@
comment:
on-update: recreate
on-update: edit
header: |
Thank you for contributing to Dashy! ✨
Hi {{ prAuthor }}! Thank you for contributing to Dashy! ✨
footer: |
---
> I'm a bot, and this is an automated comment 🤖
snippets:
- id: docs-changes
files:
- '*.md'
- '**/*.md'
files: ['*.md', '**/*.md']
body: |
When making changes to the documentation, be sure to double check that:
- Link and images URLs properly resolve
- Your spelling and grammar is correct
- Any markdown formatting is valid
- id: vue-config
files:
- vue.config.js
body: >
You're making changes to the main Vue app config. Please test the app thoroughly,
as any misconfigurations here may cause the app to stop functioning.
- id: server-entry
files:
- server.js
body: >
You're making changes to the main server entry point. Please test the app thoroughly,
as any misconfigurations here may cause the app to stop functioning.
- id: dependency-changes
files:
- yarn.lock
body: >
When updating dependencies, take a moment to verify that there are not security
issues associated with any added or modified packages. If adding a new dependency,
ensure that it is totally necessary, and check the packages size is not too large,
as this will increase overall bundle size.
- id: environmental-vars
files: [ '.env', '*.env', '.env*' ]
body: >
You're making changes to the main server entry point. Please test the app thoroughly,
as any misconfigurations here may cause the app to stop functioning.
- id: license
files: [ 'LICENSE', '**/**/LICENSE*' ]
body: >
Dashy is licensed under MIT. Your modifying the license file, which shouldn't usually
need to be changed. Please ensure that you intended to make this update before continuing.
- id: cname-file
files:
- CNAME
body: >
Are you sure you want to modify the CNAME file? This may stop the documentation
website hosted on GitHub pages from working.
- id: git-ignore
files:
- .gitignore
body: >
When modifying the .gitignore, please do not remove any of the existing paths,
as this may cause files and directories to be unintentionally committed to git
- id: netlify-file
files:
- netlify.toml
body: >
Please ensure you've tested the app on Netlify, so that the 1-Click deployment
does not break, before merging these changes
- id: heroku-ignore
files:
- Procfile
body: >
Please ensure you've tested the app on Heroku, so that the 1-Click deployment
does not break, before merging these changes
- id: ignored-dist
files:
- /dist
body: >
Please do not commit the built application to git. The contents of the dist
directory will be generated after the app is compiled
- id: ignored-dependencies
files:
- /node_modules
body: >
Please do not commit dependencies to git. Node modules will be pulled down
when yarn is run, prior to building the app
- id: code-owners
files:
- /.github/CODEOWNERS
body: >
Are you adding yourself as a code owner? Please specify the file path as specific
as possible, and only assign yourself to files that you created and wish to help
maintain (such as a language file, specific feature or widget).
If the above is not met, your PR will be declined or modified.
65 changes: 56 additions & 9 deletions .github/pr-badge.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
# Config file for pull-request-badge. Enables badges to be assigned to certain PRs.
# Config file for pull-request-badge. See: https://pullrequestbadge.com/
# Enables badges to be inserted into the PR description, based on certain conditions

# Checks if the required sections are missing
- label: "Missing"
- label: "⚠️Missing"
message: "Category"
color: "#f25265"
when: "$payload.pull_request.body.includes('Category') === false"
- label: "Missing"
- label: "⚠️Missing"
message: "Overview"
color: "#f25265"
when: "$payload.pull_request.body.includes('Overview') === false"
- label: "Missing"
- label: "⚠️Missing"
message: "Quality Checklist"
color: "#f25265"
when: "$payload.pull_request.body.includes('Code Quality Checklist') === false"
- label: "Description"
when: "$payload.pull_request.body.length < 25"
- label: "⚠️Description"
message: "Incomplete"
color: "#f25265"
when: "$payload.pull_request.body.length < 25"
- label: "⚠️Missing"
message: "Label"
color: "#f25265"
when: "$labels.length == 0"

# Show note when in draft mode
- label: "Status"
message: "Draft"
when: "$isDraft"
color: "#ffa933"

# Add size label based on very large or tiny PRs
- label: "PR Size"
Expand All @@ -32,14 +43,50 @@
- label: "#$prNumber"
message: "$payload.pull_request.user.login /$payload.pull_request.head.ref → $payload.repository.full_name"
color: "#ab5afc"
url: "https://github.com/$slug/tree/$branchName"

# Show total code added minus deleted
- label: "New Code"
message: "Commits: $payload.pull_request.commits | Files Changed: $payload.pull_request.changed_files | Additions: $payload.pull_request.additions-$payload.pull_request.deletions"
color: "#dddd00"

# Show submitting user's username
- label: Submitted by
# Show submitting user's username and profile link
- label: 💕 Submitted by
message: "$payload.pull_request.user.login"
color: "#fc7bf1"
color: "#f73ae6"
when: "$payload.pull_request.author_association !== 'OWNER'"
url: "https://github.com/$payload.pull_request.user.login"

# Show a badge indicating the PR category
- label: "Type"
message: "✨ Feature"
color: "#39b0fd"
when: "$labels.includes('✨ New Feature')"
- label: "Type"
message: "🐛 Fix"
color: "#39b0fd"
when: "$labels.includes('🦋 Bug Fix')"
- label: "Type"
message: "📕 Docs"
color: "#39b0fd"
when: "$labels.includes('📕 Docs')"
- label: "Type"
message: "🛠️ Build Changes"
color: "#39b0fd"
when: "$labels.includes('🛠️ Build Changes')"
- label: "Type"
message: "🛠️ Build Changes"
color: "#39b0fd"
when: "$labels.includes('🛠️ Build Changes')"
- label: "Type"
message: "🚚 Refactor"
color: "#39b0fd"
when: "$labels.includes('🚚 Refactor')"
- label: "Type"
message: "💄 Stylistic Changes"
color: "#39b0fd"
when: "$labels.includes('💄 Stylistic Changes')"
- label: "Type"
message: "🌟 Showcase Addition"
color: "#39b0fd"
when: "$labels.includes('💯 Showcase')"
27 changes: 27 additions & 0 deletions .github/workflows/add-comment-from-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Based on a label applied to an issue, the bot will add a comment with some additional info
name: Post Status from Label
on:
issues:
types:
- labeled
- unlabeled
pull_request_target:
types:
- labeled
- unlabeled
permissions:
contents: read
issues: write
pull-requests: write

jobs:
comment:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Label Commenter
uses: peaceiris/actions-label-commenter@v1
with:
config_file: ./path_to/your_config.yml
github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
16 changes: 16 additions & 0 deletions .github/workflows/auto-tag-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Creates a new tag, whenever the app version (in package.json) is updated in master
name: Create Tag
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: butlerlogic/action-autotag@stable
with:
GITHUB_TOKEN: '${{ secrets.BOT_GITHUB_TOKEN }}'
strategy: package
commit_message_template: "🔖 {{number}} {{message}} (by {{author}})\nSHA: {{sha}}\n."
File renamed without changes.
21 changes: 21 additions & 0 deletions .github/workflows/close-incomplete-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Close any issue that does not match any of the issue templates
name: Close Non-Compliant Issues
on:
issues:
types: [opened, edited]
jobs:
auto_close_issues:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Automatically close issues that don't follow the issue template
uses: lucasbento/auto-close-issues@v1.0.2
with:
github-token: ${{ secrets.BOT_GITHUB_TOKEN }}
closed-issues-label: '🙁 Auto-Closed'
issue-close-message: |
Hello @${issue.user.login} 👋
Unfortunately your issue does not follow the format outlined in the template, and has therefore been auto-closed.
To ensure that all relevant info is included, please either update or recreate your issue, and complete the sub-headings provided.
Thank you :)
29 changes: 29 additions & 0 deletions .github/workflows/close-stale-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Closes any issues that no longer have user interaction
name: 'Close stale issues and PRs'
on:
workflow_dispatch:
schedule:
- cron: '0 1 * * *' # Run at 01:00 each day
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4
with:
repo-token: ${{ secrets.BOT_GITHUB_TOKEN }}
days-before-stale: 42
days-before-close: 5
operations-per-run: 30
remove-stale-when-updated: true
enable-statistics: true
stale-issue-message: 'This issue has gone 6 weeks without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. Otherwise it will be closed in 5 working days.'
stale-pr-message: 'This PR is stale because it has been open 6 weeks with no activity. Either remove the stale label or comment below with a short update, otherwise this PR will be closed in 5 days.'
close-issue-message: 'This issue was automatically closed because it has been stalled for over 6 weeks with no activity.'
close-pr-message: 'This pull request was automatically closed because it has been stalled for over 6 weeks with no activity.'
stale-issue-label: '⚰️ Stale'
close-issue-label: '🕸️ Inactive'
stale-pr-label: '⚰️ Stale'
close-pr-label: '🕸️ Inactive'
exempt-issue-labels: '📌 Keep Open'
exempt-pr-labels: '📌 Keep Open'
labels-to-add-when-unstale: '📌 Keep Open'
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Lints code merged into master branch
name: Lint Code Base
on:
push:
pull_request:
branches: [master]
jobs:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/code-spell-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Finds typos in the English language within the app, submits a PR with fixes
name: Auto-Fix Spelling
on:
- push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
if: startsWith(github.head_ref, 'AUTO/') == false
uses: actions/checkout@v2
- name: Spell Check
if: startsWith(github.head_ref, 'AUTO/') == false
uses: sobolevn/misspell-fixer-action@master
- name: Create PR
uses: peter-evans/create-pull-request@v3.10.1
if: startsWith(github.head_ref, 'AUTO/') == false
with:
token: ${{ secrets.BOT_GITHUB_TOKEN }}
commit-message: ':pencil2: Auto-fix typos in text'
title: '[AUTO] Fix spelling and language'
branch: 'AUTO/spelling-corrections'
committer: 'Liss-Bot <alicia-gh-bot@mail.as93.net>'
assignees: Lissy93
reviewers: Lissy93
Loading

0 comments on commit 28a1a57

Please sign in to comment.