From 06386079d4126c98e68932cb1853afb927cec80c Mon Sep 17 00:00:00 2001 From: Thang Bui Quang <89576896+thangbuiq@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:38:19 +0000 Subject: [PATCH 01/24] feat: add core actions for pr --- .github/PULL_REQUEST_TEMPLATE.md | 0 .github/assign.yml | 17 +++++++++++ .github/labeler.yml | 28 +++++++++++++++++++ .github/workflows/auto_assign.yml | 12 ++++++++ ...ependabot.auto.yml => auto_dependabot.yml} | 2 +- .github/workflows/auto_labeler.yml | 11 ++++++++ .../{codespaces-image.yml => codespaces.yml} | 0 7 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/assign.yml create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/auto_assign.yml rename .github/workflows/{dependabot.auto.yml => auto_dependabot.yml} (99%) create mode 100644 .github/workflows/auto_labeler.yml rename .github/workflows/{codespaces-image.yml => codespaces.yml} (100%) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..e69de29 diff --git a/.github/assign.yml b/.github/assign.yml new file mode 100644 index 0000000..6f9ea1f --- /dev/null +++ b/.github/assign.yml @@ -0,0 +1,17 @@ +# Set to true to add reviewers to pull requests +addReviewers: true + +# Set to true to add assignees to pull requests +addAssignees: false + +# A list of reviewers to be added to pull requests (GitHub user name) +reviewers: + - lelouvincx + - thangbuiq + - greyyT + - TuanTran0910 + - ubunchuu-admin + +# A number of reviewers added to the pull request +# Set 0 to add all the reviewers (default: 0) +numberOfReviewers: 0 diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..2de5d5c --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,28 @@ +# You can refer README of this repo for future mantainances: https://github.com/actions/labeler + +source: + - all: + - changed-files: + - any-glob-to-any-file: 'src/**/*' + - all-globs-to-all-files: '!src/docs/*' + +content-documentation: + - changed-files: + - any-glob-to-any-file: + - docs/**/* + +content-blog: + - changed-files: + - any-glob-to-any-file: + - blog/**/* + +devops-maintain: + - changed-files: + - any-glob-to-any-file: + - .github/**/* + - .devcontainer/**/* + +docker: + - changed-files: + - any-glob-to-any-file: + - Dockerfile diff --git a/.github/workflows/auto_assign.yml b/.github/workflows/auto_assign.yml new file mode 100644 index 0000000..7934c24 --- /dev/null +++ b/.github/workflows/auto_assign.yml @@ -0,0 +1,12 @@ +name: 'Auto Assign' +on: + pull_request: + types: [opened, ready_for_review] + +jobs: + add-reviews: + runs-on: ubuntu-latest + steps: + - uses: kentaro-m/auto-assign-action@v2.0.0 + with: + configuration-path: '.github/assign.yml' diff --git a/.github/workflows/dependabot.auto.yml b/.github/workflows/auto_dependabot.yml similarity index 99% rename from .github/workflows/dependabot.auto.yml rename to .github/workflows/auto_dependabot.yml index 3dc9969..5ee2ead 100644 --- a/.github/workflows/dependabot.auto.yml +++ b/.github/workflows/auto_dependabot.yml @@ -33,7 +33,7 @@ jobs: curl -X PUT \ -H "Authorization: Bearer ${{ secrets.TOKEN_GITHUB }}" \ -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/merge?merge_method=merge" + "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/merge?merge_method=squash" env: USER_NAME: ubunchuu[bot] USER_EMAIL: 159746302+ubunchuu-admin@users.noreply.github.com diff --git a/.github/workflows/auto_labeler.yml b/.github/workflows/auto_labeler.yml new file mode 100644 index 0000000..f4299f2 --- /dev/null +++ b/.github/workflows/auto_labeler.yml @@ -0,0 +1,11 @@ +name: 'Pull Request Labeler' +on: pull_request + +jobs: + labeler: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v5 diff --git a/.github/workflows/codespaces-image.yml b/.github/workflows/codespaces.yml similarity index 100% rename from .github/workflows/codespaces-image.yml rename to .github/workflows/codespaces.yml From c28b31de81e84aae15c9ef9fbb45f7e65107ddf5 Mon Sep 17 00:00:00 2001 From: Thang Bui Quang <89576896+thangbuiq@users.noreply.github.com> Date: Wed, 14 Feb 2024 04:03:03 +0000 Subject: [PATCH 02/24] feat: add test workflows --- .github/PULL_REQUEST_TEMPLATE.md | 63 +++++++++++++++++++++++ .github/labeler.yml | 2 +- .github/workflows/auto_assign.yml | 4 +- .github/workflows/auto_dependabot.yml | 5 +- .github/workflows/auto_labeler.yml | 6 ++- .github/workflows/codespaces.yml | 31 +++++++++-- .github/workflows/pages.yml | 74 ++++++++++++++++++++++----- 7 files changed, 162 insertions(+), 23 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e69de29..8c1482e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,63 @@ +## 🐧 Ubunchuu Contribute Request + + + +## ❓️ What type of PR is this? (check all applicable) + +- [ ] πŸ“ Content - Documentation Update +- [ ] πŸ“ Content - Blog Update +- [ ] 🎨 Style (UI/UX) +- [ ] πŸ• Feature +- [ ] πŸͺ² Bug Fix +- [ ] πŸ€– DevOps +- [ ] πŸ§‘β€πŸ’» Code Refactor + +## πŸ“ Description for my changes + +> Please clear this section and include a very short summary of the change (3 lines maximum) + + + +## πŸ“Œ Related Issues + +> ❗️MANDATORY❗️ + +> Please clear this section and note that any changes to the codebase should have a related issue to provide context for the changes. + + + +## πŸ–₯️ Mobile/Desktop Screenshots (optinal) + + + +> If applicable, add screenshots to help explain your changes. + +> Please clear this whole section if not applicable. + +--- + + + + diff --git a/.github/labeler.yml b/.github/labeler.yml index 2de5d5c..a3ef428 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -4,7 +4,7 @@ source: - all: - changed-files: - any-glob-to-any-file: 'src/**/*' - - all-globs-to-all-files: '!src/docs/*' + - all-globs-to-all-files: '!docs/*' content-documentation: - changed-files: diff --git a/.github/workflows/auto_assign.yml b/.github/workflows/auto_assign.yml index 7934c24..acf286b 100644 --- a/.github/workflows/auto_assign.yml +++ b/.github/workflows/auto_assign.yml @@ -1,11 +1,11 @@ -name: 'Auto Assign' +name: 'Pull Request Assigner' on: pull_request: types: [opened, ready_for_review] jobs: add-reviews: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: kentaro-m/auto-assign-action@v2.0.0 with: diff --git a/.github/workflows/auto_dependabot.yml b/.github/workflows/auto_dependabot.yml index 5ee2ead..df2d651 100644 --- a/.github/workflows/auto_dependabot.yml +++ b/.github/workflows/auto_dependabot.yml @@ -1,4 +1,4 @@ -name: Auto approve and merge PRs by dependabot +name: 'Dependabot Auto Approve and Merge PR' on: pull_request: branches: [main] @@ -26,7 +26,8 @@ jobs: USER_EMAIL: 159746302+ubunchuu-admin@users.noreply.github.com APPROVE_TEXT: Legit to bot βœ… - - name: Auto merge + - name: Auto merge for github_actions label + if: contains(github.event.pull_request.labels.*.name, 'github_actions') run: | git config --global user.name "${USER_NAME}" git config --global user.email "${USER_EMAIL}" diff --git a/.github/workflows/auto_labeler.yml b/.github/workflows/auto_labeler.yml index f4299f2..30a8ce0 100644 --- a/.github/workflows/auto_labeler.yml +++ b/.github/workflows/auto_labeler.yml @@ -1,11 +1,13 @@ name: 'Pull Request Labeler' -on: pull_request +on: + pull_request: + types: [opened, ready_for_review] jobs: labeler: permissions: contents: read pull-requests: write - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/labeler@v5 diff --git a/.github/workflows/codespaces.yml b/.github/workflows/codespaces.yml index a296629..dcefa76 100644 --- a/.github/workflows/codespaces.yml +++ b/.github/workflows/codespaces.yml @@ -1,6 +1,11 @@ -name: Create and publish a Docker image +# Path: .github/workflows/codespaces.yml +name: Publish a Docker image for the devcontainer on: + pull_request: + branches: ['main'] + paths: + - Dockerfile push: branches: ['main'] paths: @@ -12,8 +17,26 @@ env: IMAGE_NAME: ubunchuu-truong-us/devcontainer:latest jobs: + build-test-image: + runs-on: ubuntu-22.04 + permissions: + contents: read + packages: read + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: false + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + build-and-push-image: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 + if: github.event_name == 'push' + needs: [build-test-image] permissions: contents: read packages: write @@ -22,14 +45,14 @@ jobs: uses: actions/checkout@v4 - name: Log in to the Container registry - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ env.USER }} password: ${{ secrets.TOKEN_GITHUB }} - name: Build and push Docker image - uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + uses: docker/build-push-action@v4 with: context: . push: true diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 9ada81f..9bec3ac 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,9 +1,10 @@ -name: Docusaurus Deploy +name: 'Docusaurus CI/CD' on: push: - branches: - - main + branches: ['main'] + pull_request: + branches: ['main'] permissions: contents: read @@ -11,28 +12,77 @@ permissions: id-token: write jobs: - deploy: - name: Deploy to GitHub Pages - runs-on: ubuntu-latest + build-and-serve: + name: Build and Test Serving + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Setup Node.js Environment + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Install Dependencies + run: yarn install --frozen-lockfile + + - name: Build Website + run: yarn build + + - name: Verify Build Output + run: | + if [ -d "build" ]; then + echo "Build successful" + else + echo "Build failed" + exit 1 + fi + + - name: Test Server Functionality + run: | + yarn serve & + sleep 5 + kill %1 + + - name: Comment on Pull Request + if: github.event_name == 'pull_request' + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Test server functionality passed βœ…' + }); + + deploy-docusaurus: + if: github.event_name == 'push' + needs: [build-and-serve] + name: Deploy Docusaurus to GitHub Pages + runs-on: ubuntu-22.04 + steps: + - name: Checkout Code (with Submodules) + uses: actions/checkout@v4 with: submodules: 'recursive' - - uses: actions/setup-node@v4 + - name: Setup Node.js Environment + uses: actions/setup-node@v4 with: node-version: '18' - - name: Install dependencies + - name: Install Dependencies run: yarn install --frozen-lockfile - - name: Build website + - name: Build Website run: yarn build - - name: Setup Pages + - name: Configure GitHub Pages uses: actions/configure-pages@v4 - - name: Upload artifact + - name: Upload Website Artifact uses: actions/upload-pages-artifact@v3 with: path: './build' From b9d7c15e589691e2296ae26354af293780050f0b Mon Sep 17 00:00:00 2001 From: Thang Bui Quang <89576896+thangbuiq@users.noreply.github.com> Date: Wed, 14 Feb 2024 04:15:32 +0000 Subject: [PATCH 03/24] fix: add permission for pr --- .github/workflows/pages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 9bec3ac..9d7316c 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -10,6 +10,7 @@ permissions: contents: read pages: write id-token: write + pull-requests: write jobs: build-and-serve: From 0767c3b34c78135ba91783c27416af12a9944fb3 Mon Sep 17 00:00:00 2001 From: Thang Bui Quang <89576896+thangbuiq@users.noreply.github.com> Date: Wed, 14 Feb 2024 04:24:35 +0000 Subject: [PATCH 04/24] feat: add time comment --- .github/workflows/pages.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 9d7316c..1dc4317 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -26,10 +26,14 @@ jobs: node-version: '18' - name: Install Dependencies - run: yarn install --frozen-lockfile + run: | + echo "before_time=$(date +%s)" >> $GITHUB_ENV + yarn install --frozen-lockfile - name: Build Website - run: yarn build + run: | + yarn build + echo "after_time=$(date +%s)" >> $GITHUB_ENV - name: Verify Build Output run: | @@ -50,12 +54,13 @@ jobs: if: github.event_name == 'pull_request' uses: actions/github-script@v7 with: + github-token: ${{ secrets.TOKEN_GITHUB }} script: | github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: 'Test server functionality passed βœ…' + body: 'Test server functionality passed βœ… with total CI time: ' + (process.env.after_time - process.env.before_time) + ' seconds' }); deploy-docusaurus: From 2b12ee02055f38dd4e42fcdcadf2ea17ce9ce7df Mon Sep 17 00:00:00 2001 From: Thang Bui Quang <89576896+thangbuiq@users.noreply.github.com> Date: Thu, 15 Feb 2024 02:23:59 +0000 Subject: [PATCH 05/24] feat: update image for codespace --- .devcontainer/devcontainer.json | 6 +++--- Dockerfile | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8005b81..201d6e1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,9 +7,9 @@ "terminal.integrated.defaultProfile.linux": "bash", "terminal.integrated.experimentalRestore": true, "actionButtons": { - "reloadButton": "♻️" /* Custom reload button text */, - "defaultColor": "#ff0034" /* Can also use string color names */, - "loadNpmCommands": false /* Disables automatic generation of actions for npm commands */, + "reloadButton": "♻️", + "defaultColor": "#ff0034", + "loadNpmCommands": false, "commands": [ { "cwd": "${workspaceFolder}", diff --git a/Dockerfile b/Dockerfile index 060f642..3be0a29 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,4 +24,6 @@ USER ${DOCKERUSER} # Install starship for non-root user with pure prompt RUN \ sh -c "$(curl -fsSL https://starship.rs/install.sh)" -- --yes -b /home/${DOCKERUSER}/.local/bin && \ - echo 'eval "$(starship init bash && starship preset pure-preset -o ~/.config/starship.toml)"' >> /home/${DOCKERUSER}/.bashrc + echo 'starship preset pure-preset -o ~/.config/starship.toml' >> /home/${DOCKERUSER}/.bashrc && \ + echo 'eval "$(starship init bash)"' >> /home/${DOCKERUSER}/.bashrc + From 192c00994cc93112a00fb818dac4f287260681f6 Mon Sep 17 00:00:00 2001 From: Thang Bui Quang <89576896+thangbuiq@users.noreply.github.com> Date: Thu, 15 Feb 2024 02:28:31 +0000 Subject: [PATCH 06/24] feat: update docker workflow --- .github/workflows/{codespaces.yml => codespaces-image.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{codespaces.yml => codespaces-image.yml} (93%) diff --git a/.github/workflows/codespaces.yml b/.github/workflows/codespaces-image.yml similarity index 93% rename from .github/workflows/codespaces.yml rename to .github/workflows/codespaces-image.yml index dcefa76..5c52f3d 100644 --- a/.github/workflows/codespaces.yml +++ b/.github/workflows/codespaces-image.yml @@ -1,5 +1,5 @@ # Path: .github/workflows/codespaces.yml -name: Publish a Docker image for the devcontainer +name: Publish Docker image for codespaces on: pull_request: @@ -52,7 +52,7 @@ jobs: password: ${{ secrets.TOKEN_GITHUB }} - name: Build and push Docker image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5.0.0 with: context: . push: true From 3e322d7ba8d95abc83eb018a4372a80b2ca39774 Mon Sep 17 00:00:00 2001 From: Thang Bui Quang <89576896+thangbuiq@users.noreply.github.com> Date: Fri, 16 Feb 2024 06:08:38 +0000 Subject: [PATCH 07/24] feat: add event trigger labeler --- .github/labeler.yml | 22 ++++++++++++---------- .github/workflows/auto_dependabot.yml | 2 +- .github/workflows/auto_labeler.yml | 2 +- .github/workflows/codespaces-image.yml | 2 +- .github/workflows/pages.yml | 4 ++-- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index a3ef428..fa956b7 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,17 +1,23 @@ # You can refer README of this repo for future mantainances: https://github.com/actions/labeler source: - - all: - - changed-files: - - any-glob-to-any-file: 'src/**/*' - - all-globs-to-all-files: '!docs/*' + - changed-files: + - any-glob-to-any-file: + - 'src/**/*' + - '**/*.js' + +content: + - changed-files: + - any-glob-to-any-file: + - blog/**/* + - docs/**/* -content-documentation: +documentation: - changed-files: - any-glob-to-any-file: - docs/**/* -content-blog: +blog: - changed-files: - any-glob-to-any-file: - blog/**/* @@ -21,8 +27,4 @@ devops-maintain: - any-glob-to-any-file: - .github/**/* - .devcontainer/**/* - -docker: - - changed-files: - - any-glob-to-any-file: - Dockerfile diff --git a/.github/workflows/auto_dependabot.yml b/.github/workflows/auto_dependabot.yml index df2d651..c579d62 100644 --- a/.github/workflows/auto_dependabot.yml +++ b/.github/workflows/auto_dependabot.yml @@ -1,4 +1,4 @@ -name: 'Dependabot Auto Approve and Merge PR' +name: 'Dependabot' on: pull_request: branches: [main] diff --git a/.github/workflows/auto_labeler.yml b/.github/workflows/auto_labeler.yml index 30a8ce0..c287cf2 100644 --- a/.github/workflows/auto_labeler.yml +++ b/.github/workflows/auto_labeler.yml @@ -1,7 +1,7 @@ name: 'Pull Request Labeler' on: pull_request: - types: [opened, ready_for_review] + types: [opened, ready_for_review, reopened, synchronize] jobs: labeler: diff --git a/.github/workflows/codespaces-image.yml b/.github/workflows/codespaces-image.yml index 5c52f3d..be82021 100644 --- a/.github/workflows/codespaces-image.yml +++ b/.github/workflows/codespaces-image.yml @@ -1,5 +1,5 @@ # Path: .github/workflows/codespaces.yml -name: Publish Docker image for codespaces +name: Codespaces Image on: pull_request: diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 1dc4317..568d8b3 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -14,7 +14,7 @@ permissions: jobs: build-and-serve: - name: Build and Test Serving + name: Test Build and Serving runs-on: ubuntu-22.04 steps: - name: Checkout Code @@ -66,7 +66,7 @@ jobs: deploy-docusaurus: if: github.event_name == 'push' needs: [build-and-serve] - name: Deploy Docusaurus to GitHub Pages + name: Deploy to GitHub Pages runs-on: ubuntu-22.04 steps: - name: Checkout Code (with Submodules) From 68f55f013203eae3f96a9cb5dc6e162344fa1ab1 Mon Sep 17 00:00:00 2001 From: Thang Bui Quang <89576896+thangbuiq@users.noreply.github.com> Date: Fri, 16 Feb 2024 06:30:24 +0000 Subject: [PATCH 08/24] feat: add lint test --- .github/workflows/auto_assign.yml | 3 ++- .github/workflows/auto_labeler.yml | 3 ++- .github/workflows/codespaces-image.yml | 1 + .github/workflows/lint.yml | 28 ++++++++++++++++++++++++++ .github/workflows/pages.yml | 2 +- 5 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/auto_assign.yml b/.github/workflows/auto_assign.yml index acf286b..194cf27 100644 --- a/.github/workflows/auto_assign.yml +++ b/.github/workflows/auto_assign.yml @@ -1,10 +1,11 @@ -name: 'Pull Request Assigner' +name: 'PR Assigner' on: pull_request: types: [opened, ready_for_review] jobs: add-reviews: + name: Auto runs-on: ubuntu-22.04 steps: - uses: kentaro-m/auto-assign-action@v2.0.0 diff --git a/.github/workflows/auto_labeler.yml b/.github/workflows/auto_labeler.yml index c287cf2..a9ce982 100644 --- a/.github/workflows/auto_labeler.yml +++ b/.github/workflows/auto_labeler.yml @@ -1,10 +1,11 @@ -name: 'Pull Request Labeler' +name: 'PR Labeler' on: pull_request: types: [opened, ready_for_review, reopened, synchronize] jobs: labeler: + name: Auto permissions: contents: read pull-requests: write diff --git a/.github/workflows/codespaces-image.yml b/.github/workflows/codespaces-image.yml index be82021..fbba37e 100644 --- a/.github/workflows/codespaces-image.yml +++ b/.github/workflows/codespaces-image.yml @@ -18,6 +18,7 @@ env: jobs: build-test-image: + name: Test runs-on: ubuntu-22.04 permissions: contents: read diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..3372104 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,28 @@ +name: Lint + +on: + pull_request: + push: + branches: ['main'] + +jobs: + markdown: + name: Markdown + runs-on: ubuntu-22.04 + + permissions: + contents: read + packages: read + statuses: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check markdown files + uses: avto-dev/markdown-lint@v1 + with: + args: '**/*.md' + ignore: ./README.md diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 568d8b3..3e0ce2c 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -14,7 +14,7 @@ permissions: jobs: build-and-serve: - name: Test Build and Serving + name: Test runs-on: ubuntu-22.04 steps: - name: Checkout Code From 884292a0533ea56ead4b52113c32ef894e89bb84 Mon Sep 17 00:00:00 2001 From: Thang Bui Quang <89576896+thangbuiq@users.noreply.github.com> Date: Fri, 16 Feb 2024 06:50:00 +0000 Subject: [PATCH 09/24] feat: add lint markdown config --- .github/workflows/lint.yml | 21 ++++++++++++--- .markdownlint.json | 54 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 .markdownlint.json diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3372104..45bafcc 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,8 +21,21 @@ jobs: with: fetch-depth: 0 - - name: Check markdown files - uses: avto-dev/markdown-lint@v1 + - uses: DavidAnson/markdownlint-cli2-action@v15 with: - args: '**/*.md' - ignore: ./README.md + config: '.markdownlint.json' + globs: '**/*.md' + continue-on-error: true + + - name: Comment on Pull Request + if: github.event_name == 'pull_request' + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.TOKEN_GITHUB }} + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: ${{ steps.markdown.outputs.summary }} + }) diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..62d4e88 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,54 @@ +{ + "code-block-style": { + "style": "fenced" + }, + "code-fence-style": { + "style": "backtick" + }, + "emphasis-style": { + "style": "asterisk" + }, + "fenced-code-language": { + "allowed_languages": ["yaml"], + "language_only": true + }, + "heading-style": { + "style": "atx" + }, + "hr-style": { + "style": "---" + }, + "line-length": false, + "link-image-style": { + "autolink": false, + "inline": false, + "collapsed": false, + "shortcut": false + }, + "no-duplicate-heading": { + "siblings_only": true + }, + "ol-prefix": { + "style": "ordered" + }, + "proper-names": { + "code_blocks": false, + "names": [ + "CommonMark", + "JavaScript", + "Markdown", + "markdownlint", + "markdownlint-cli2" + ] + }, + "strong-style": { + "style": "asterisk" + }, + "table-pipe-style": { + "style": "leading_and_trailing" + }, + "ul-style": { + "style": "dash" + }, + "no-inline-html": false +} From 0b0f639ebd9f975d0acef0f19a0bf81b8db4b149 Mon Sep 17 00:00:00 2001 From: Thang Bui Quang <89576896+thangbuiq@users.noreply.github.com> Date: Fri, 16 Feb 2024 06:58:33 +0000 Subject: [PATCH 10/24] feat: add warning to fail job --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 45bafcc..37ebaad 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,10 +22,10 @@ jobs: fetch-depth: 0 - uses: DavidAnson/markdownlint-cli2-action@v15 + continue-on-error: true with: config: '.markdownlint.json' globs: '**/*.md' - continue-on-error: true - name: Comment on Pull Request if: github.event_name == 'pull_request' From 57e469e19b461327f69389ac144cb0c6695c7a24 Mon Sep 17 00:00:00 2001 From: Thang Bui Quang <89576896+thangbuiq@users.noreply.github.com> Date: Fri, 16 Feb 2024 07:01:23 +0000 Subject: [PATCH 11/24] test --- .github/workflows/lint.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 37ebaad..12cd091 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,6 +22,7 @@ jobs: fetch-depth: 0 - uses: DavidAnson/markdownlint-cli2-action@v15 + id: markdownlint continue-on-error: true with: config: '.markdownlint.json' @@ -37,5 +38,5 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: ${{ steps.markdown.outputs.summary }} + body: 'Linting report: ${{ steps.markdownlint.outputs.lintResults }}' }) From 7c6ccd5f86219197b079edfc1f1871e50a8adb73 Mon Sep 17 00:00:00 2001 From: Thang Bui Quang <89576896+thangbuiq@users.noreply.github.com> Date: Fri, 16 Feb 2024 07:05:01 +0000 Subject: [PATCH 12/24] remove lint test --- .github/workflows/lint.yml | 42 -------------------------------------- 1 file changed, 42 deletions(-) delete mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 12cd091..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Lint - -on: - pull_request: - push: - branches: ['main'] - -jobs: - markdown: - name: Markdown - runs-on: ubuntu-22.04 - - permissions: - contents: read - packages: read - statuses: write - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: DavidAnson/markdownlint-cli2-action@v15 - id: markdownlint - continue-on-error: true - with: - config: '.markdownlint.json' - globs: '**/*.md' - - - name: Comment on Pull Request - if: github.event_name == 'pull_request' - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.TOKEN_GITHUB }} - script: | - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Linting report: ${{ steps.markdownlint.outputs.lintResults }}' - }) From 609c975c02c4a2a35e2c6a729399f5b8fa9a6464 Mon Sep 17 00:00:00 2001 From: Thang Bui Quang <89576896+thangbuiq@users.noreply.github.com> Date: Fri, 16 Feb 2024 07:17:00 +0000 Subject: [PATCH 13/24] feat: add pull request create workflow --- ...T_TEMPLATE.md => pull_request_template.md} | 2 +- .github/workflows/contribute.yml | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) rename .github/{PULL_REQUEST_TEMPLATE.md => pull_request_template.md} (98%) create mode 100644 .github/workflows/contribute.yml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/pull_request_template.md similarity index 98% rename from .github/PULL_REQUEST_TEMPLATE.md rename to .github/pull_request_template.md index 8c1482e..f9ff8ca 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/pull_request_template.md @@ -1,4 +1,4 @@ -## 🐧 Ubunchuu Contribute Request +# 🐧 Ubunchuu Contribute Request