-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Established placement for HTML API download (#46)
- Loading branch information
1 parent
1915d99
commit 284c5cb
Showing
5 changed files
with
3,018 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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,43 @@ | ||
#!/bin/bash -x | ||
# (C) Copyright 2022 Hewlett Packard Enterprise Development LP | ||
# | ||
|
||
set -eu | ||
|
||
WATCH_DIR=${WATCH_DIR:-.} | ||
|
||
if [[ -n `git status -s ${WATCH_DIR}` ]] | ||
then | ||
git add ${WATCH_DIR} | ||
git commit -m "${GIT_COMMIT_MESSAGE:-commit changes}" | ||
else | ||
echo "${WATCH_DIR} is already up-to-date" | ||
exit 0 | ||
fi | ||
|
||
REMOTE="${REMOTE:-https://x-access-token:${GITHUB_TOKEN}@github.com/${REPOSITORY}}" | ||
|
||
MAX_RETRIES=${MAX_RETRIES:-3} | ||
ATTEMPT=0 | ||
while true | ||
do | ||
if git push "${REMOTE}" | ||
then | ||
break | ||
fi | ||
|
||
ATTEMPT=$((ATTEMPT + 1)) | ||
if [[ ${ATTEMPT} -ge ${MAX_RETRIES} ]] | ||
then | ||
echo "Failed to successfully sync with remote after ${MAX_RETRIES} attempts" | ||
exit 1 | ||
fi | ||
|
||
echo "Try ${ATTEMPT}: failed to push, waiting 2 seconds before fetching latest and retrying..." | ||
|
||
sleep 2 | ||
|
||
git pull --rebase "${REMOTE}" | ||
done | ||
|
||
echo "Successfully pushed latest changes to remote" |
This file contains 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,46 @@ | ||
#(C) Copyright 2022 Hewlett Packard Enterprise Development LP | ||
|
||
name: HTML Doc | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout workspace | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.13.2 | ||
|
||
- name: Install dependencies | ||
run: | | ||
# redocly CLI | ||
npm i -g redoc-cli | ||
# yq | ||
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O yq | ||
chmod +x yq | ||
export PATH=${PATH}:`pwd` | ||
- name: Generate HTML doc | ||
run: (cd v1 && make gen-html) | ||
|
||
- name: Commit changes | ||
run: .github/workflows/commit-changes.sh | ||
env: | ||
WATCH_DIR: "v1/html" | ||
GIT_AUTHOR_NAME: ${{ github.actor }} | ||
GIT_AUTHOR_EMAIL: ${{ github.actor }}@users.noreply.github.com | ||
GIT_COMMITTER_NAME: GitHub Actions | ||
GIT_COMMITTER_EMAIL: actions@github.com | ||
GIT_COMMIT_MESSAGE: | | ||
[dependabot skip] Sync changes with gen-html | ||
BRANCH_REF: ${{ github.event.pull_request.head.ref }} | ||
REPOSITORY: ${{ github.repository }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains 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 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
Large diffs are not rendered by default.
Oops, something went wrong.