-
Notifications
You must be signed in to change notification settings - Fork 557
70 lines (57 loc) · 2.03 KB
/
Copy pathapi-fix-docs-artefacts.yml
File metadata and controls
70 lines (57 loc) · 2.03 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
name: API Documentation Artefacts Auto-Update
on:
pull_request:
paths:
- api/**
types: [opened, synchronize, reopened, ready_for_review]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
defaults:
run:
working-directory: api
env:
DOTENV_OVERRIDE_FILE: .env-ci
jobs:
fix-docs-artefacts:
runs-on: depot-ubuntu-latest
name: Fix Documentation Artefacts
permissions:
contents: read # For actions/checkout
id-token: write # For CodeArtifact OIDC
steps:
- name: Generate GitHub App token with push access
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.FLAGSMITH_ENGINEERING_GH_APP_ID }}
private-key: ${{ secrets.FLAGSMITH_ENGINEERING_GH_APP_PRIVATE_KEY }}
- name: Cloning repo
uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ steps.app-token.outputs.token }}
- uses: ./.github/actions/install-uv
with:
working-directory: api
- name: Install SAML Dependencies
run: sudo apt-get install -y xmlsec1
- name: Generate public documentation artefacts
run: |
make install-packages opts='--extra dev'
make generate-docs
- name: Authenticate with CodeArtifact
uses: ./.github/actions/codeartifact-login
- name: Generate private documentation artefacts
run: make generate-docs-private
- name: Commit and push fixes
run: |
git add --all
if git diff --cached --quiet; then
echo "Documentation artefacts are up to date."
exit 0
fi
git config user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config user.email '${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
git commit --message 'chore: Update documentation artefacts'
git push || { git pull --rebase && git push; }