Skip to content

Commit a409e10

Browse files
authored
update release workflow to use pat
1 parent bbd8cea commit a409e10

1 file changed

Lines changed: 36 additions & 1 deletion

File tree

.github/workflows/release.yaml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ jobs:
66
deploy:
77
if: ${{ github.ref == 'refs/heads/main' }}
88
runs-on: ubuntu-latest
9+
environment: documentation
910
steps:
1011
- uses: actions/checkout@v3
1112

@@ -14,7 +15,41 @@ jobs:
1415
with:
1516
publish-templates: "true"
1617
base-path-to-templates: "./src"
17-
generate-docs: "false"
18+
generate-docs: "true"
1819

20+
env:
21+
GITHUB_TOKEN: ${{ secrets.PAT_DS_PY_R }}
22+
23+
- name: Create PR for Documentation
24+
id: push_image_info
1925
env:
2026
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
run: |
28+
set -e
29+
echo "Start."
30+
31+
# Configure git and Push updates
32+
git config --global user.email github-actions@github.com
33+
git config --global user.name github-actions
34+
git config pull.rebase false
35+
36+
branch=automated-documentation-update-$GITHUB_RUN_ID
37+
git checkout -b $branch
38+
message='Automated documentation update'
39+
40+
# Add / update and commit
41+
git add */**/README.md
42+
git commit -m 'Automated documentation update [skip ci]' || export NO_UPDATES=true
43+
44+
# Push
45+
if [ "$NO_UPDATES" != "true" ] ; then
46+
git push origin "$branch"
47+
gh api \
48+
--method POST \
49+
-H "Accept: application/vnd.github+json" \
50+
/repos/${GITHUB_REPOSITORY}/pulls \
51+
-f title="$message" \
52+
-f body="$message" \
53+
-f head="$branch" \
54+
-f base='main'
55+
fi

0 commit comments

Comments
 (0)