4
4
push :
5
5
branches : [master]
6
6
pull_request : {}
7
+ repository_dispatch :
8
+ types : [update-foundry-submodule-docs]
7
9
8
10
concurrency :
9
11
group : checks-${{ github.ref }}
53
55
run : yarn coverage
54
56
55
57
- uses : codecov/codecov-action@v5
58
+
59
+ update-foundry-submodule-docs :
60
+ if : github.event_name == 'repository_dispatch'
61
+ runs-on : ubuntu-latest
62
+
63
+ steps :
64
+ - uses : actions/checkout@v4
65
+ with :
66
+ submodules : true
67
+ fetch-depth : 0
68
+
69
+ - name : Set up environment
70
+ uses : ./.github/actions/setup
71
+
72
+ - name : Update submodule
73
+ run : |
74
+ cd submodules/openzeppelin-foundry-upgrades
75
+ git fetch origin main
76
+ git reset --hard origin/main
77
+
78
+ - name : Regenerate docs
79
+ run : yarn docs:foundry:ci
80
+
81
+ - name : Check for changes in docs/modules/ROOT/pages/foundry/
82
+ id : check_changes
83
+ run : |
84
+ [ -n "$(git diff --name-only HEAD -- docs/modules/ROOT/pages/foundry/)" ] && echo "SHOULD_COMMIT_DOC_UPDATE=true" >> $GITHUB_ENV || true
85
+
86
+ - name : Set Git identity
87
+ if : env.SHOULD_COMMIT_DOC_UPDATE == 'true'
88
+ run : |
89
+ git config user.name "github-actions[bot]"
90
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
91
+
92
+ - name : Create new branch, commit and push changes
93
+ if : env.SHOULD_COMMIT_DOC_UPDATE == 'true'
94
+ run : |
95
+ BRANCH_NAME="ci/update-foundry-docs-$(date +'%Y-%m-%d-%H%M%S')-${{ github.run_id }}"
96
+ echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
97
+ git checkout -b $BRANCH_NAME
98
+ git add docs/modules/ROOT/pages/foundry/
99
+ git commit -m "[CI] Update Foundry Upgrades plugin docs"
100
+ git push origin $BRANCH_NAME
101
+
102
+ - name : Create a Pull Request for docs changes
103
+ id : create_pull_request
104
+ if : env.SHOULD_COMMIT_DOC_UPDATE == 'true'
105
+ env :
106
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
107
+ run : |
108
+ gh pr create --title "[CI] Update Foundry Upgrades plugin docs" \
109
+ --body "This Pull Request updates the docs for the Foundry Upgrades plugin" \
110
+ --base master \
111
+ --head $BRANCH_NAME || echo "Pull Request creation failed"
112
+
113
+ - name : Clean up branch if Pull Request creation fails
114
+ if : steps.create_pull_request.outcome == 'failure'
115
+ run : |
116
+ git push origin --delete $BRANCH_NAME
117
+
0 commit comments