-
Notifications
You must be signed in to change notification settings - Fork 549
ci: Fix documentation artefacts automatically #8024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a6fa48a
180332d
f38778a
e61a1a6
a35b11c
0d3bb9d
59e37ca
0fea7ad
b4d8473
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,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 }} | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| - 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; } | ||
|
Comment on lines
+69
to
+70
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this violates SOC2.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean having app pushing to
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean having anything pushing to main bypassing the PR approval mechanism.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great catch. This runs in the PR now (0d3bb9d).
coderabbitai[bot] marked this conversation as resolved.
|
||
Uh oh!
There was an error while loading. Please reload this page.