Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/create-release-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/fix-vulnerabilities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ 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:
name: Gather facts
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
Expand Down Expand Up @@ -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"
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/go-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ./...
13 changes: 6 additions & 7 deletions .github/workflows/publish-techdocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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:
Expand Down
56 changes: 28 additions & 28 deletions .github/workflows/validate-changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"*)
Expand All @@ -42,37 +42,37 @@ 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"
echo "Available changelog entries:"
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"
Expand All @@ -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"
Expand All @@ -142,37 +142,37 @@ 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
with:
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
- \`### Fixed\` - for any bug fixes
- \`### 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,
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/validate-workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
extends: default
rules:
line-length:
max: 200
document-start: disable
Loading