-
Notifications
You must be signed in to change notification settings - Fork 2
66 lines (59 loc) · 3.1 KB
/
devportal-update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Update Devportal Documentation
on:
push:
paths:
- 'README.md'
jobs:
update-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
# Step 1: Clone the Devportal Repository
- name: Clone Devportal Repository
env:
GITHUB_TOKEN: ${{ secrets.DEVPORTAL_DOCS_UPDATE_TOKEN }}
run: |
git clone https://github.com/rsksmart/devportal.git
cd devportal
git checkout -b update-from-foundry-starter || git checkout update-from-foundry-starter
cd ..
# Step 2: Transform Each File and Copy to Devportal Repository
- name: Transform Files for Devportal
run: |
mkdir -p transformed
# Process README.md
echo "---" > transformed/README.md
echo "sidebar_label: Rootstock Foundry Starter kit" >> transformed/README.md
echo "sidebar_position: 500" >> transformed/README.md
echo "title: Rootstock Foundry Starter kit" >> transformed/README.md
echo "description: 'Whether you are a seasoned developer or just starting your journey into smart contract development, the foundry starter kit provides a solid foundation for building decentralized applications (dApps) on the Rootstock network.'" >> transformed/README.md
echo "tags: [rsk, rootstock, tutorials, developers, foundry, quick starts, dApps, smart contracts]" >> transformed/README.md
echo "---" >> transformed/README.md
echo "" >> transformed/README.md
echo ":::info[Note]" >> transformed/README.md
echo "You can add your suggestion on the [Foundry Starter Kit Repository](https://github.com/rsksmart/rootstock-foundry-starterkit.git)" >> transformed/README.md
echo ":::" >> transformed/README.md
echo "" >> transformed/README.md
cat README.md >> transformed/README.md
cp transformed/README.md devportal/docs/02-developers/04-quickstart/foundry.md
# Step 3: Commit and Push Changes to Devportal Repository
- name: Commit and Push Changes
run: |
cd devportal
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/02-developers/04-quickstart/foundry.md
git commit -m "Automated update from repository"
git push -f origin update-from-foundry-starter
# Step 4: Create a Pull Request in the Devportal Repository
- name: Create Pull Request
env:
GITHUB_TOKEN: ${{ secrets.DEVPORTAL_DOCS_UPDATE_TOKEN }}
run: |
cd devportal
curl -L -X POST -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.DEVPORTAL_DOCS_UPDATE_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/rsksmart/devportal/pulls \
-d '{"title":"Automated update of documentation","body":"This PR updates the Devportal documentation with the latest changes from the original repository.","head":"update-from-foundry-starter","base":"main"}'