Skip to content

Commit f2fb23c

Browse files
authored
Documentation enforced for PRs to merge (#1227)
* documented checks added for PRs * condition checks improved * better log for failure * check existing labels * PR checks updated * update trigger * fixed a bug that would've made dev push perpetually when it's eventually merged to main
1 parent f7389b7 commit f2fb23c

File tree

4 files changed

+59
-3
lines changed

4 files changed

+59
-3
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Documentation Check 📚
2+
3+
on:
4+
workflow_call:
5+
pull_request:
6+
branches:
7+
- main
8+
- dev
9+
types:
10+
- labeled
11+
12+
jobs:
13+
documentation_check:
14+
name: Documentation Check 📚
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Success
18+
if: ${{ github.event.label.name == 'documented' || contains( github.event.pull_request.labels.*.name, 'documented') }}
19+
run: echo "Documentation Check Passed"
20+
- name: Failure
21+
if: ${{ github.event.label.name != 'documented' && !contains( github.event.pull_request.labels.*.name, 'documented') }}
22+
run: |
23+
echo "Documentation Check Failed - Missing 'documented' label on Pull Request"
24+
exit 1

.github/workflows/pull_request_checks_dev.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ jobs:
1616
analyze_code:
1717
name: Analyze 🧐
1818
if: ${{ github.event.action == 'ready_for_review' || github.event.label.name == 'ready-to-merge'}}
19-
uses: ChainSafe/web3.unity/.github/workflows/codeql.yml@main
19+
uses: ChainSafe/web3.unity/.github/workflows/codeql.yml@main
20+
documentation_check:
21+
name: Documentation Check 📚
22+
uses: ChainSafe/web3.unity/.github/workflows/documentation_check.yml@main

.github/workflows/pull_request_checks_main.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
check_commit:
1414
name: Check Commit 📝
1515
runs-on: ubuntu-latest
16-
if: ${{ !github.event.pull_request.draft }}
16+
if: ${{ !github.event.pull_request.draft && contains( github.event.pull_request.labels.*.name, 'ready-to-merge') }}
1717
outputs:
1818
commit_message: ${{ steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE }}
1919
steps:
@@ -33,7 +33,7 @@ jobs:
3333
if: ${{ needs.check_commit.outputs.commit_message == 'Sync Dependencies - Auto Commit' }}
3434
needs: [ check_commit ]
3535
steps:
36-
- run: echo "..."
36+
- run: echo "Proceeding to checks..."
3737

3838
web3_tests:
3939
name: Web3 tests 🕸
@@ -48,6 +48,10 @@ jobs:
4848
uses: ChainSafe/web3.unity/.github/workflows/unity_tests.yml@main
4949
needs: [ pre_job ]
5050
secrets: inherit
51+
documentation_check:
52+
name: Documentation Check 📚
53+
uses: ChainSafe/web3.unity/.github/workflows/documentation_check.yml@main
54+
needs: [ pre_job ]
5155
duplicate_samples:
5256
name: Duplicate Samples 🪞
5357
if: ${{ github.event.action == 'ready_for_review' || github.event.label.name == 'ready-to-merge'}}

.github/workflows/push_checks_dev.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,34 @@ on:
55
branches: [ dev ]
66

77
jobs:
8+
check_commit:
9+
name: Check Last Commit 📝
10+
runs-on: ubuntu-latest
11+
outputs:
12+
commit_message: ${{ steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE }}
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
with:
17+
ref: ${{ github.head_ref || github.ref_name }}
18+
lfs: true
19+
ssh-key: ${{ secrets.DEPLOY_KEY }}
20+
- name: Get Head Commit Message
21+
id: get_head_commit_message
22+
run: echo "HEAD_COMMIT_MESSAGE=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"
23+
24+
pre_job:
25+
name: Pre Job 🚀
26+
runs-on: ubuntu-latest
27+
if: ${{ needs.check_commit.outputs.commit_message != 'Sync Dependencies - Auto Commit' }}
28+
needs: [ check_commit ]
29+
steps:
30+
- run: echo "Proceeding to checks..."
31+
832
sync_dependencies:
933
name: Sync Dependencies 🔄
1034
uses: ChainSafe/web3.unity/.github/workflows/sync_dependencies.yaml@main
35+
needs: [ pre_job ]
1136
secrets: inherit
1237
duplicate_samples:
1338
name: Duplicate Samples 🪞

0 commit comments

Comments
 (0)