diff --git a/.github/workflows/create-release-pr.yaml b/.github/workflows/create-release-pr.yaml index f2e8f29..bafa0bb 100644 --- a/.github/workflows/create-release-pr.yaml +++ b/.github/workflows/create-release-pr.yaml @@ -26,12 +26,12 @@ jobs: name: Gather facts runs-on: ubuntu-24.04 outputs: - repo_name: ${{ steps.gather_facts.outputs.repo_name }} - branch: ${{ steps.gather_facts.outputs.branch }} - base: ${{ steps.gather_facts.outputs.base }} + repo_name: ${{ steps.gather_facts.outputs.repo_name }} + branch: ${{ steps.gather_facts.outputs.branch }} + base: ${{ steps.gather_facts.outputs.base }} needs_major_bump: ${{ steps.gather_facts.outputs.needs_major_bump }} - skip: ${{ steps.pr_exists.outputs.skip }} - version: ${{ steps.gather_facts.outputs.version }} + skip: ${{ steps.pr_exists.outputs.skip }} + version: ${{ steps.gather_facts.outputs.version }} steps: - name: Gather facts id: gather_facts diff --git a/.github/workflows/fix-vulnerabilities.yaml b/.github/workflows/fix-vulnerabilities.yaml index 8fa37fd..5b0f2b4 100644 --- a/.github/workflows/fix-vulnerabilities.yaml +++ b/.github/workflows/fix-vulnerabilities.yaml @@ -8,12 +8,12 @@ on: required: true type: string secrets: - HERALD_APP_ID: - description: App ID for create-github-app-token - required: true - HERALD_APP_KEY: - description: Private key for create-github-app-token - required: true + HERALD_APP_ID: + description: App ID for create-github-app-token + required: true + HERALD_APP_KEY: + description: Private key for create-github-app-token + required: true jobs: gather_facts: @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-24.04 outputs: branch: ${{ steps.gather_facts.outputs.branch }} - skip : ${{ steps.gather_facts.outputs.skip }} + skip: ${{ steps.gather_facts.outputs.skip }} steps: - name: Checkout code uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 @@ -81,7 +81,7 @@ jobs: - name: Run nancy-fixer fix uses: docker://gsoci.azurecr.io/giantswarm/nancy-fixer:0.5.1 timeout-minutes: 20 - + - name: Set up git identity run: | git config --local user.email "149080493+heraldbot[bot]@users.noreply.github.com" diff --git a/.github/workflows/go-coverage.yaml b/.github/workflows/go-coverage.yaml index 2b6909c..5820f28 100644 --- a/.github/workflows/go-coverage.yaml +++ b/.github/workflows/go-coverage.yaml @@ -22,22 +22,22 @@ jobs: # Needed to create a comment on the commit contents: write steps: - - name: Clone repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - # default fetch-depth is insufficent to find previous coverage notes - fetch-depth: 10 + - name: Clone repository + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + # default fetch-depth is insufficent to find previous coverage notes + fetch-depth: 10 - - name: Create coverage report - uses: gwatts/go-coverage-action@2845595538a59d63d1bf55f109c14e104c6f7cb3 # v2.0.0 - id: coverage - env: + - name: Create coverage report + uses: gwatts/go-coverage-action@2845595538a59d63d1bf55f109c14e104c6f7cb3 # v2.0.0 + id: coverage + env: GITHUB_TOKEN: "${{ secrets.token }}" - with: - # Optional coverage threshold - # use fail-coverage to determine what should happen below this threshold - #coverage-threshold: 80 - fail-coverage: 1 + with: + # Optional coverage threshold + # use fail-coverage to determine what should happen below this threshold + #coverage-threshold: 80 + fail-coverage: 1 - # collect coverage for all packages beyond the one under test - cover-pkg: ./... + # collect coverage for all packages beyond the one under test + cover-pkg: ./... diff --git a/.github/workflows/publish-techdocs.yaml b/.github/workflows/publish-techdocs.yaml index e27295e..05c1968 100644 --- a/.github/workflows/publish-techdocs.yaml +++ b/.github/workflows/publish-techdocs.yaml @@ -43,18 +43,18 @@ jobs: ./node_modules restore-keys: | ${{ runner.os }}-build-${{ env.cache-name }}- - + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} name: List the state of node modules continue-on-error: true run: npm list - + - name: Install techdocs-cli run: npm install @techdocs/cli - name: Show techdocs-cli version run: ./node_modules/@techdocs/cli/bin/techdocs-cli --version - + - name: Generate mkdocs configuration id: generate_mkdocs_config shell: python {0} @@ -132,22 +132,21 @@ jobs: with open("mkdocs.yml", "w") as f: f.write(output) - + with open(os.environ["GITHUB_OUTPUT"], "a") as f: f.write("content_found=true\n") - - if: ${{ steps.generate_mkdocs_config.outputs.content_found == 'true' }} name: Generate documentation run: | mkdir $GITHUB_WORKSPACE/tmp-docs-output $GITHUB_WORKSPACE/node_modules/@techdocs/cli/bin/techdocs-cli \ generate --verbose --output-dir=$GITHUB_WORKSPACE/tmp-docs-output - + - if: ${{ steps.generate_mkdocs_config.outputs.content_found == 'true' }} name: Show output run: ls -la $GITHUB_WORKSPACE/tmp-docs-output - + - if: ${{ steps.generate_mkdocs_config.outputs.content_found == 'true' }} name: Publish env: diff --git a/.github/workflows/validate-changelog.yaml b/.github/workflows/validate-changelog.yaml index 0c65b96..96d898e 100644 --- a/.github/workflows/validate-changelog.yaml +++ b/.github/workflows/validate-changelog.yaml @@ -27,9 +27,9 @@ jobs: run: | branch_name="$BRANCH_NAME" echo "Branch name: $branch_name" - + version="" - + # Use case statement for more reliable pattern matching case "$branch_name" in *"#release#v"*) @@ -42,20 +42,20 @@ jobs: exit 1 fi ;; - + *"#release#major"|*"#release#minor"|*"#release#patch") # Extract bump type and get version from changelog bump_type=$(echo "$branch_name" | sed -E 's/.*#release#(major|minor|patch).*/\1/') echo "🔍 Detected semantic version branch ($bump_type), extracting version from changelog..." - + if [ ! -f "CHANGELOG.md" ]; then echo "::error::CHANGELOG.md not found" exit 1 fi - + # Get the first version entry (should be the newest one that architect created) version=$(grep -E "^## \[[0-9]+\.[0-9]+\.[0-9]+\]" CHANGELOG.md | head -1 | sed -E 's/^## \[([0-9]+\.[0-9]+\.[0-9]+)\].*/\1/') - + if [ -z "$version" ]; then echo "::error::Could not find version in CHANGELOG.md" echo "::error::Expected to find a line like: ## [X.Y.Z] - YYYY-MM-DD" @@ -63,16 +63,16 @@ jobs: grep -E "^## \[" CHANGELOG.md | head -5 || echo "No version entries found" exit 1 fi - + echo "Extracted version from changelog for $bump_type release: $version" ;; - + *) echo "::error::Could not extract version from branch name: $branch_name" echo "::error::Expected patterns:" echo " - main#release#v1.2.3" echo " - main#release#major" - echo " - main#release#minor" + echo " - main#release#minor" echo " - main#release#patch" echo " - master#release#v1.2.3" echo " - master#release#major|minor|patch" @@ -81,54 +81,54 @@ jobs: exit 1 ;; esac - + if [ -z "$version" ]; then echo "::error::Version extraction failed - version is empty" exit 1 fi - + echo "Final extracted version: $version" echo "version=$version" >> $GITHUB_OUTPUT - + - name: Validate changelog content run: | version="${{ steps.extract_version.outputs.version }}" changelog_file="CHANGELOG.md" - + echo "Validating changelog content for version $version..." echo "Checking file: $changelog_file" - + # Check if CHANGELOG.md exists if [ ! -f "$changelog_file" ]; then echo "::error::No $changelog_file found in repository" exit 1 fi - + # Extract the content between the new version and the next version changelog_section=$(awk " /^## \[$version\]/ { found=1; print; next } found && /^## \[/ && !/^## \[$version\]/ { found=0 } found { print } " "$changelog_file") - + if [ -z "$changelog_section" ]; then echo "::error::No section found for version $version in changelog" echo "::error::Expected format: ## [$version] - YYYY-MM-DD" exit 1 fi - + echo "Found changelog section for version $version" - + # Check if there are any ### headers (Added, Changed, Deprecated, Removed, Fixed, Security) subsection_count=$(echo "$changelog_section" | grep -c "^### " || true) - + if [ "$subsection_count" -eq 0 ]; then echo "::error title=Empty Changelog::No changelog content found for version $version" echo "::error::The release appears to have an empty changelog." echo "" echo "Please add content under appropriate sections like:" echo " ### Added - for new features" - echo " ### Changed - for changes in existing functionality" + echo " ### Changed - for changes in existing functionality" echo " ### Fixed - for any bug fixes" echo " ### Removed - for now removed features" echo " ### Deprecated - for soon-to-be removed features" @@ -142,7 +142,7 @@ jobs: echo "Sections found:" echo "$changelog_section" | grep "^### " | sed 's/^/ /' fi - + - name: Add PR comment if validation fails if: failure() uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # 7.0.1 @@ -150,9 +150,9 @@ jobs: script: | const version = '${{ steps.extract_version.outputs.version }}'; const body = `## 📝 Changelog Validation Failed - + The changelog for version **${version}** appears to be empty. - + Please add content under appropriate sections like: - \`### Added\` - for new features - \`### Changed\` - for changes in existing functionality @@ -160,19 +160,19 @@ jobs: - \`### Removed\` - for now removed features - \`### Deprecated\` - for soon-to-be removed features - \`### Security\` - in case of vulnerabilities - + **Example:** \`\`\`markdown ## [${version}] - ${new Date().toISOString().split('T')[0]} - + ### Changed - + - Updated dependency X to version Y - Improved error handling in module Z \`\`\` - + This check will pass once you add proper changelog content.`; - + github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, diff --git a/.github/workflows/validate-workflows.yaml b/.github/workflows/validate-workflows.yaml index f5c2351..c8ff2e0 100644 --- a/.github/workflows/validate-workflows.yaml +++ b/.github/workflows/validate-workflows.yaml @@ -15,6 +15,11 @@ jobs: - name: Checkout code uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - name: Validate YAML + uses: docker://gsoci.azurecr.io/giantswarm/yamllint:1.0.0 + with: + args: --format=github . + - name: Validate GitHub Actions uses: jazzsequence/github-action-validator@843ac61ce962184aa316e582398e99c744e4215f # v1.0.0 with: diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000..7bbce9d --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,6 @@ +--- +extends: default +rules: + line-length: + max: 200 + document-start: disable