From 32abfdc94b1fa599d3ad8d40eb018acb99843177 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 21 Feb 2024 00:04:42 +0800 Subject: [PATCH 1/5] Refactor existing workflows to use reusable workflows --- .github/workflows/mkdocs-deploy.yml | 20 ++------------------ .github/workflows/release-drafter.yml | 7 +------ .github/workflows/run-pre-commit.yml | 13 +++---------- 3 files changed, 6 insertions(+), 34 deletions(-) diff --git a/.github/workflows/mkdocs-deploy.yml b/.github/workflows/mkdocs-deploy.yml index b44b7753..09dbdf00 100644 --- a/.github/workflows/mkdocs-deploy.yml +++ b/.github/workflows/mkdocs-deploy.yml @@ -5,21 +5,5 @@ on: workflow_dispatch: jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - name: Install python action for doc extraction - run: pip install -r docs/requirements.txt - - name: check mkdocs build - if: github.ref != 'refs/heads/main' - run: mkdocs build - - name: Build docs and deploy to gh-pages - if: github.ref == 'refs/heads/main' - run: | - git config user.name 'github-actions' - git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - mkdocs gh-deploy --force + build_docs: + uses: cpp-linter/.github/.github/workflows/mkdocs.yml@reusable-workflows diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index fb8f44b3..f0aca8fb 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -8,9 +8,4 @@ on: jobs: update_release_draft: - runs-on: ubuntu-latest - steps: - # Draft your next Release notes as Pull Requests are merged into the default branch - - uses: release-drafter/release-drafter@v6 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: cpp-linter/.github/.github/workflows/release-drafter.yml@reusable-workflows diff --git a/.github/workflows/run-pre-commit.yml b/.github/workflows/run-pre-commit.yml index 0df19030..1bab4e9d 100644 --- a/.github/workflows/run-pre-commit.yml +++ b/.github/workflows/run-pre-commit.yml @@ -1,4 +1,4 @@ -name: Pre-commit +name: Run pre-commit on: push: @@ -6,12 +6,5 @@ on: types: opened jobs: - check-source-files: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - run: python3 -m pip install pre-commit - - run: pre-commit run --all-files + run-pre-commit: + uses: cpp-linter/.github/.github/workflows/pre-commit.yml@reusable-workflows From dc70ffd15a02982216ab721d04fac1e812a90148 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 21 Feb 2024 00:10:05 +0800 Subject: [PATCH 2/5] Refactor existing workflows to use reusable workflows --- .github/workflows/run-pre-commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-pre-commit.yml b/.github/workflows/run-pre-commit.yml index 1bab4e9d..364970ea 100644 --- a/.github/workflows/run-pre-commit.yml +++ b/.github/workflows/run-pre-commit.yml @@ -7,4 +7,4 @@ on: jobs: run-pre-commit: - uses: cpp-linter/.github/.github/workflows/pre-commit.yml@reusable-workflows + uses: cpp-linter/.github/.github/workflows/pre-commit.yml@reusable-workflows From 364073a02b161fb6888080f94d23b7ed653b6c21 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 21 Feb 2024 00:12:50 +0800 Subject: [PATCH 3/5] Update job names --- .github/workflows/mkdocs-deploy.yml | 2 +- .github/workflows/release-drafter.yml | 2 +- .github/workflows/run-pre-commit.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mkdocs-deploy.yml b/.github/workflows/mkdocs-deploy.yml index 09dbdf00..9db26fe3 100644 --- a/.github/workflows/mkdocs-deploy.yml +++ b/.github/workflows/mkdocs-deploy.yml @@ -5,5 +5,5 @@ on: workflow_dispatch: jobs: - build_docs: + build-docs: uses: cpp-linter/.github/.github/workflows/mkdocs.yml@reusable-workflows diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index f0aca8fb..78ee751d 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -7,5 +7,5 @@ on: workflow_dispatch: jobs: - update_release_draft: + draft-release: uses: cpp-linter/.github/.github/workflows/release-drafter.yml@reusable-workflows diff --git a/.github/workflows/run-pre-commit.yml b/.github/workflows/run-pre-commit.yml index 364970ea..415f187d 100644 --- a/.github/workflows/run-pre-commit.yml +++ b/.github/workflows/run-pre-commit.yml @@ -6,5 +6,5 @@ on: types: opened jobs: - run-pre-commit: + pre-commit: uses: cpp-linter/.github/.github/workflows/pre-commit.yml@reusable-workflows From dbdc431919fb745f3927812f78d264cbb461841c Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Wed, 21 Feb 2024 03:36:55 -0500 Subject: [PATCH 4/5] Update .github/workflows/mkdocs-deploy.yml Co-authored-by: Brendan <2bndy5@gmail.com> --- .github/workflows/mkdocs-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mkdocs-deploy.yml b/.github/workflows/mkdocs-deploy.yml index 9db26fe3..4d3e5190 100644 --- a/.github/workflows/mkdocs-deploy.yml +++ b/.github/workflows/mkdocs-deploy.yml @@ -6,4 +6,4 @@ on: jobs: build-docs: - uses: cpp-linter/.github/.github/workflows/mkdocs.yml@reusable-workflows + uses: cpp-linter/.github/.github/workflows/mkdocs.yml@main From 9765d8b3caa2d3025a85b377506de56cdb15e3a4 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 21 Feb 2024 08:38:09 +0000 Subject: [PATCH 5/5] Update workflows to point main branch --- .github/workflows/release-drafter.yml | 2 +- .github/workflows/run-pre-commit.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 78ee751d..2250d389 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -8,4 +8,4 @@ on: jobs: draft-release: - uses: cpp-linter/.github/.github/workflows/release-drafter.yml@reusable-workflows + uses: cpp-linter/.github/.github/workflows/release-drafter.yml@main diff --git a/.github/workflows/run-pre-commit.yml b/.github/workflows/run-pre-commit.yml index 415f187d..ecc47aa7 100644 --- a/.github/workflows/run-pre-commit.yml +++ b/.github/workflows/run-pre-commit.yml @@ -7,4 +7,4 @@ on: jobs: pre-commit: - uses: cpp-linter/.github/.github/workflows/pre-commit.yml@reusable-workflows + uses: cpp-linter/.github/.github/workflows/pre-commit.yml@main