forked from open-feature/openfeature.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (65 loc) · 2.13 KB
/
update-sdk-docs.yaml
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
67
68
69
70
71
72
73
74
75
76
name: Update SDK Docs
on:
schedule:
- cron: '0 8 * * 1-5'
workflow_dispatch:
jobs:
build:
if: github.repository == 'open-feature/openfeature.dev'
runs-on: ubuntu-latest
env:
BRANCH_NAME: update-sdk-readmes
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
submodules: recursive
fetch-depth: 0
# Avoid using the GitHub token in the git config
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Set up git
shell: bash
run: |
git config --global user.name "OpenFeature Bot"
git config --global user.email "[email protected]"
- name: Checkout branch
shell: bash
run: |
if git rev-parse --verify $BRANCH_NAME >/dev/null 2>&1
then
echo "Branch exists, checking out"
git checkout $BRANCH_NAME
else
echo "Branch does not exist, creating"
git checkout -b $BRANCH_NAME
fi
- name: Ensure branch is up to date
shell: bash
run: |
git reset --hard origin/main
- name: Update SDKs and commit changes
shell: bash
run: |
yarn run update:sdk-docs && \
git add --all && \
git commit -m 'chore: update sdk readmes' -s
- name: Push changes
uses: ad-m/github-push-action@d91a481090679876dfc4178fef17f286781251df # v0.8.0
with:
github_token: ${{ secrets.PULL_REQUEST_AUTOMATION }}
branch: ${{ env.BRANCH_NAME }}
force: true
- name: Create pr if doesn't exist
shell: bash
continue-on-error: true
run: |
gh pr create --title "chore: update sdk readmes" --body "The PR was automatically generated via the update-sdk-docs GitHub workflow." --base main --head $BRANCH_NAME
env:
GITHUB_TOKEN: ${{ secrets.PULL_REQUEST_AUTOMATION }}