e1eb70b602
* attempt to skip doc generation on pull request branches * try different commenting style * Generate docs from job=validate_atomics_generate_docs branch=circle-for-forks
51 lines
1.6 KiB
YAML
51 lines
1.6 KiB
YAML
version: 2
|
|
|
|
defaults: &defaults
|
|
docker:
|
|
- image: circleci/ruby:2.4
|
|
|
|
workflows:
|
|
version: 2
|
|
validate-then-generate-docs:
|
|
jobs:
|
|
- validate_atomics_generate_docs
|
|
|
|
jobs:
|
|
validate_atomics_generate_docs:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- add_ssh_keys
|
|
|
|
- run:
|
|
name: Validate the format of atomic tests against the spec
|
|
command: |
|
|
bin/validate-atomics.rb
|
|
|
|
- run:
|
|
name: Generate nice markdown document for atomics
|
|
command: |
|
|
bin/generate-atomic-docs.rb
|
|
|
|
echo ""
|
|
echo ""
|
|
git status
|
|
echo ""
|
|
echo ""
|
|
git diff-index HEAD --
|
|
|
|
if git diff-index --quiet HEAD -- ; then
|
|
echo "Not committing documentation because there are no changes"
|
|
#elif [[ "${CIRCLE_BRANCH}" == "master" ]]; then
|
|
# echo "Not committing documentation because we are on master and doc changes should be part of pull request branches"
|
|
elif [[ $(echo "$CIRCLE_BRANCH" | grep -c "pull") -gt 0 ]]; then
|
|
echo "Not committing documentation because we are on a pull request branch that we don't have push permissions to"
|
|
else
|
|
git config credential.helper 'cache --timeout=120'
|
|
git config user.email "<email>"
|
|
git config user.name "CircleCI Atomic Red Team doc generator"
|
|
|
|
git add atomics
|
|
git commit -am "Generate docs from job=$CIRCLE_JOB branch=$CIRCLE_BRANCH"
|
|
git push -u origin $CIRCLE_BRANCH
|
|
fi |