Repository navigation
79 lines (67 loc) · 2.29 KB
/
Copy pathupdate-sdk-docs.yaml
File metadata and controls
79 lines (67 loc) · 2.29 KB
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
77
78
79
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive
fetch-depth: 0
# Avoid using the GitHub token in the git config
persist-credentials: false
- name: Enable Corepack
run: corepack enable
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
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 "109696520+openfeaturebot@users.noreply.github.com"
- 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@881a6320fdb16eb5318c5054f31c218aec2b324c # v1.3.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 }}