diff --git a/.github/workflows/authors-and-third-party-notices.yaml b/.github/workflows/authors-and-third-party-notices.yaml index 07a0fe1c7dc..36ad11fc2b9 100644 --- a/.github/workflows/authors-and-third-party-notices.yaml +++ b/.github/workflows/authors-and-third-party-notices.yaml @@ -13,6 +13,9 @@ permissions: jobs: update_generated_files: + if: | + github.event_name == "schedule" || + !startsWith(github.event.head_commit.message, "chore: update AUTHORS, THIRD-PARTY-NOTICES, Security Test Summary") name: Update automatically generated files runs-on: ubuntu-latest env: @@ -69,7 +72,17 @@ jobs: npm run update-tracking-plan git add docs/tracking-plan.md - # - name: Commit and push - # run: | - # git commit --no-allow-empty -m "chore: update AUTHORS, THIRD-PARTY-NOTICES, Security Test Summary" || true - # git push + - name: Commit and push + run: | + # We can't rely on git not allowing empty commits by default: the + # empty commit check happens before the pre-commit hooks run and if + # there is no diff exists after precommit logic was executed, empty + # commit will still be generated. Instead of that we will allow empty + # commit to happen and will check it directly if it's empty or not + git commit --allow-empty -m "chore: update AUTHORS, THIRD-PARTY-NOTICES, Security Test Summary" + if [ $(git diff-tree --name-only --no-commit-id HEAD | wc -l) -gt 0 ]; then + echo "Files changed, pushing update..." + git push + else + echo "No changes to push" + fi diff --git a/package.json b/package.json index 3720bd64aec..d25b01690f9 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,9 @@ "update-authors": "node scripts/generate-authors.js", "preupdate-third-party-notices": "npm run -w packages/compass compile", "update-third-party-notices": "cp packages/compass/THIRD-PARTY-NOTICES.md .", + "postupdate-third-party-notices": "npx prettier-compass THIRD-PARTY-NOTICES.md --write", "update-tracking-plan": "npx ts-node scripts/generate-tracking-plan.ts > docs/tracking-plan.md", + "postupdate-tracking-plan": "npx prettier-compass docs/tracking-plan.md --write", "bump-packages": "bump-monorepo-packages", "publish-packages": "lerna publish from-package --no-verify-access --no-push --no-git-tag-version --yes", "version": "node ./scripts/align-monorepo-dependencies.js --no-commit", @@ -50,6 +52,7 @@ "update-evergreen-config": "node .evergreen/template-yml.js", "postupdate-evergreen-config": "evergreen validate .evergreen.yml", "update-security-test-summary": "ts-node scripts/generate-security-test-summary.ts > docs/security-test-summary.md", + "postupdate-security-test-summary": "npx prettier-compass docs/security-test-summary.md --write", "prepare": "husky install", "snyk-test": "node scripts/snyk-test.js", "pregenerate-vulnerability-report": "npm run compile -w packages/compass && npm run snyk-test",