Skip to content

Commit

Permalink
ci: automated UI file updates (#2381)
Browse files Browse the repository at this point in the history
## Description

Automate UI file updates with dependabot & github actions. This will
prevent outdated files and PR's like
#2378 will be done
automatically.

This will add a commit to every dependabot as can be seen here:
- Redoc: DjordyKoert#11
- Swagger: DjordyKoert#13
- github-actions (does not commit or error):
DjordyKoert#12

docs:
https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions

## What type of PR is this? (check all applicable)
- [ ] Bug Fix
- [ ] Feature
- [ ] Refactor
- [ ] Deprecation
- [ ] Breaking Change
- [ ] Documentation Update
- [x] CI

## Checklist
- [ ] I have made corresponding changes to the documentation (`docs/`)
- [ ] I have made corresponding changes to the changelog
(`CHANGELOG.md`)
  • Loading branch information
DjordyKoert authored Nov 7, 2024
1 parent f981465 commit ceb2fd8
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ tests export-ignore
docs export-ignore
phpunit export-ignore
phpunit.xml.dist export-ignore
utils export-ignore
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ updates:
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "npm"
directory: "/utils"
schedule:
interval: "daily"
versioning-strategy: increase
33 changes: 33 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Dependabot update UI files

on: pull_request

jobs:
dependabot:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./utils

permissions:
contents: write

if: github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: yarn install
- name: Swagger UI
run: yarn run swagger
- name: Redocly
run: yarn run redoc
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[dependabot-skip] Update UI files"
branch: ${{ github.head_ref }}
24 changes: 0 additions & 24 deletions update-js.sh

This file was deleted.

2 changes: 2 additions & 0 deletions utils/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
yarn.lock
21 changes: 21 additions & 0 deletions utils/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"description": "Script utils for nelmio/api-doc-bundle UI",
"license": "MIT",
"dependencies": {
"redoc": "2.0.0",
"swagger-ui-dist": "5.18.1"
},
"scripts": {
"swagger": "yarn run swagger:bundle && yarn run swagger:standalone && yarn run swagger:css",
"swagger:bundle": "cp node_modules/swagger-ui-dist/swagger-ui-bundle.js* $npm_package_config_destination_swagger",
"swagger:standalone": "cp node_modules/swagger-ui-dist/swagger-ui-standalone-preset.js* $npm_package_config_destinationswagger",
"swagger:css": "cp node_modules/swagger-ui-dist/swagger-ui.css* $npm_package_config_destination_swagger",
"redoc": "cp node_modules/redoc/bundles/redoc.standalone.js $npm_package_config_destination_redoc"
},
"config": {
"destination": {
"swagger": "../public/swagger-ui",
"redoc": "../public/redocly"
}
}
}

0 comments on commit ceb2fd8

Please sign in to comment.