-
Notifications
You must be signed in to change notification settings - Fork 13
Dev #169
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
Open
TatevikGr
wants to merge
8
commits into
main
Choose a base branch
from
dev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Dev #169
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
784bb28
Fix: swagger response
tatevikg1 addb913
Add workflow for updating OpenAPI specs in web frontend and limit cli…
tatevikg1 a928154
Add endpoint to retrieve all subscribe pages
tatevikg1 112abce
Developer
tatevikg1 f03fe55
Add support for subscribe page data management and validation
tatevikg1 4a4ddfd
Add public page to return list data
tatevikg1 c3bde58
After review 0
tatevikg1 6454dea
Normalize attributes key in SubscribePageData
tatevikg1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| name: Update phplist-web-frontend OpenAPI | ||
|
|
||
| permissions: | ||
| contents: write # Required to push to web-frontend repo | ||
| actions: read # Required to download artifacts | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - dev | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| jobs: | ||
| generate-openapi: | ||
| runs-on: ubuntu-22.04 | ||
| outputs: | ||
| source_branch: ${{ steps.branch.outputs.source_branch }} | ||
| steps: | ||
| - name: Determine source branch | ||
| env: | ||
| EVENT_NAME: ${{ github.event_name }} | ||
| HEAD_REF: ${{ github.head_ref }} | ||
| REF_NAME: ${{ github.ref_name }} | ||
| id: branch | ||
| run: | | ||
| if [ "$EVENT_NAME" = "pull_request" ]; then | ||
| echo "source_branch=$HEAD_REF" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "source_branch=$REF_NAME" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| - name: Checkout Source Repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| - name: Setup PHP with Composer and Extensions | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: 8.1 | ||
| extensions: mbstring, dom, fileinfo, mysql | ||
|
|
||
| - name: Cache Composer Dependencies | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: ~/.composer/cache | ||
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-composer- | ||
|
|
||
| - name: Install Composer Dependencies | ||
| run: composer install --no-interaction --prefer-dist | ||
|
|
||
| - name: Generate OpenAPI Specification JSON | ||
| run: vendor/bin/openapi -o docs/latest-restapi.json --format json src | ||
|
|
||
| - name: Upload OpenAPI Artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: openapi-json | ||
| path: docs/latest-restapi.json | ||
|
|
||
| update-web-frontend: | ||
| runs-on: ubuntu-22.04 | ||
| needs: generate-openapi | ||
| env: | ||
| TARGET_BRANCH: ${{ needs.generate-openapi.outputs.source_branch }} | ||
| steps: | ||
| - name: Checkout phpList-web-frontend Repository | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| repository: phpList/web-frontend | ||
| token: ${{ secrets.PUSH_WEB_FRONTEND }} | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Prepare target branch | ||
| run: | | ||
| git fetch origin | ||
|
|
||
| if git ls-remote --exit-code --heads origin "$TARGET_BRANCH" >/dev/null 2>&1; then | ||
| git checkout "$TARGET_BRANCH" | ||
| git pull --rebase origin "$TARGET_BRANCH" | ||
| else | ||
| git checkout -b "$TARGET_BRANCH" | ||
| fi | ||
|
|
||
| - name: Download Generated OpenAPI JSON | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: openapi-json | ||
| path: ./new-openapi | ||
|
|
||
| - name: Compare and Check for Differences | ||
| id: diff | ||
| run: | | ||
| # Compare the openapi files if old exists, else always deploy | ||
| if [ -f openapi.json ]; then | ||
| diff openapi.json new-openapi/latest-restapi.json > openapi-diff.txt || true | ||
| if [ -s openapi-diff.txt ]; then | ||
| echo "diff=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "diff=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
| else | ||
| echo "No previous openapi.json, will add." | ||
| echo "diff=true" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Update and Commit OpenAPI File | ||
| if: steps.diff.outputs.diff == 'true' | ||
| run: | | ||
| set -euo pipefail | ||
| cp new-openapi/latest-restapi.json openapi.json | ||
| git config user.name "github-actions" | ||
| git config user.email "github-actions@web-frontend.workflow" | ||
| git add openapi.json | ||
| if git diff --cached --quiet; then | ||
| echo "No changes to commit" | ||
| exit 0 | ||
| fi | ||
| git commit -m "Update openapi.json from web frontend workflow $(date -u +"%Y-%m-%dT%H:%M:%SZ")" | ||
| git fetch origin "$TARGET_BRANCH" | ||
| git rebase "origin/$TARGET_BRANCH" | ||
| git push origin HEAD:"$TARGET_BRANCH" | ||
|
|
||
| - name: Skip Commit if No Changes | ||
| if: steps.diff.outputs.diff == 'false' | ||
| run: echo "No changes to openapi.json, skipping commit." | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.