From a40e39dc39099ee6182eb9e9fa07ad03879192ff Mon Sep 17 00:00:00 2001 From: hyiso Date: Sat, 15 Jul 2023 18:00:26 +0800 Subject: [PATCH 1/4] fix: PR from fork --- .github/workflows/pr_commits.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_commits.yml b/.github/workflows/pr_commits.yml index 4115298..14a25fe 100644 --- a/.github/workflows/pr_commits.yml +++ b/.github/workflows/pr_commits.yml @@ -18,4 +18,4 @@ jobs: run: dart pub get - name: Validate PR Commits - run: VERBOSE=true dart run commitlint_cli --from="origin/${{ github.base_ref }}" --to="${{ github.head_ref }}" --config lib/commitlint.yaml + run: VERBOSE=true dart run commitlint_cli --from=${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to=${{ github.event.pull_request.head.sha }} --config lib/commitlint.yaml From 94fa18d0a9ab8c54d9b2a2cf0d66cc38a42669cd Mon Sep 17 00:00:00 2001 From: hyiso Date: Sat, 15 Jul 2023 18:05:22 +0800 Subject: [PATCH 2/4] feat: remove checkout ref --- .github/workflows/pr_commits.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/pr_commits.yml b/.github/workflows/pr_commits.yml index 14a25fe..f6fc1af 100644 --- a/.github/workflows/pr_commits.yml +++ b/.github/workflows/pr_commits.yml @@ -8,9 +8,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ github.head_ref }} - uses: dart-lang/setup-dart@v1.3 From 539968f1ed4cfaa26b778973b2262a5d5931ab58 Mon Sep 17 00:00:00 2001 From: hyiso Date: Sat, 15 Jul 2023 18:07:53 +0800 Subject: [PATCH 3/4] feat: set checkout fetch-depth to 0 --- .github/workflows/pr_commits.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr_commits.yml b/.github/workflows/pr_commits.yml index f6fc1af..fe8ed84 100644 --- a/.github/workflows/pr_commits.yml +++ b/.github/workflows/pr_commits.yml @@ -8,6 +8,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - uses: dart-lang/setup-dart@v1.3 From 1038c3f40dbb3dfa3756be8837c0a3c1ba799bd9 Mon Sep 17 00:00:00 2001 From: hyiso Date: Sat, 15 Jul 2023 18:17:23 +0800 Subject: [PATCH 4/4] docs: update example configuration for `Validate PR Commits` Github Action --- docs/guides-setup.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/guides-setup.md b/docs/guides-setup.md index 32ea75d..20374cb 100644 --- a/docs/guides-setup.md +++ b/docs/guides-setup.md @@ -101,7 +101,6 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - ref: ${{ github.head_ref }} - uses: dart-lang/setup-dart@v1.3 @@ -109,5 +108,5 @@ jobs: run: dart pub get - name: Validate PR Commits - run: dart run commitlint_cli --from="origin/${{ github.base_ref }}" --to="${{ github.head_ref }}" + run: VERBOSE=true dart run commitlint_cli --from=${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to=${{ github.event.pull_request.head.sha }} --config lib/commitlint.yaml ```