Skip to content
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

chore: move prettier step up to prevent empty PRs #5125

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/synchronize-readme.yml
Expand Up @@ -2,8 +2,8 @@ name: Synchronize Readme

on:
workflow_dispatch:
#schedule:
# - cron: '0 12 * * 1-5' # Mon-Fri at 12
schedule:
- cron: '0 12 * * 1-5' # Mon-Fri at 12

jobs:
build:
Expand All @@ -28,15 +28,17 @@ jobs:
-e "s|../.gitbook/assets/|https://github.com/snyk/user-docs/raw/HEAD/docs/.gitbook/assets/|g" \
current_gitbook.md

# Run prettier
npm clean-install
npx prettier --write current_gitbook.md

# Replace the README.md content with the GitBook content
cp current_gitbook.md ./cli/README.md

# If changes, commit and create PR
if [[ $(git -C ./cli status --porcelain) ]]; then
echo "Documentation changes detected"
cd ./cli
npm clean-install
npx prettier --write README.md
git push -f -u origin $DESTINATION_BRANCH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force pushing to a branch defined by a variable makes me really nervous, if $DESTINATION_BRANCH could be something like main. Maybe branch protection rules would prevent that (would they for actions though)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your feedback @cmars! The value for the variable is defined in this file on line 61, but is there some concern that it could be defined elsewhere and override the value specified in this file?


export SHA=$( git rev-parse $DESTINATION_BRANCH:README.md )
Expand Down