Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.

Commit c5d87d3

Browse files
authored
feat(gha): unify GHA - renovate, megalinter, markdown, and others (#493)
1 parent 8b2ff20 commit c5d87d3

33 files changed

+385
-433
lines changed

.ansible-lint

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/CODEOWNERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Users referenced in this file will automatically be requested as reviewers for
2+
# PRs that modify the given paths
3+
# See https://help.github.com/articles/about-code-owners/, https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
4+
5+
# All code
6+
* @ruzickap

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: 'Bug: This is a sample issue title'
5+
labels: bug
6+
assignees: ruzickap
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behaviour.
15+
16+
**Expected behaviour**
17+
A clear and concise description of what you expected to happen.
18+
19+
**Screenshots**
20+
If applicable, add screenshots to help explain your problem.
21+
22+
**Additional context**
23+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: GitHub Actions Community Forum
4+
url: https://github.com/orgs/community/discussions/
5+
about: Please ask questions about GitHub Actions here.
6+
- name: GitHub Pages help
7+
url: https://help.github.com/en/github/working-with-github-pages
8+
about: GitHub Pages documentation here.

.github/ISSUE_TEMPLATE/proposal.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Proposal
3+
about: Suggest an idea for this project
4+
title: 'Proposal: This is a sample title'
5+
labels: proposal
6+
assignees: ruzickap
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe**
11+
A clear and concise description of what the problem is. Ex. I'm always
12+
frustrated when [...]
13+
14+
**Describe the solution you'd like**
15+
A clear and concise description of what you want to happen.
16+
17+
**Describe alternatives you've considered**
18+
A clear and concise description of any alternative solutions or features you've considered.
19+
20+
**Additional context**
21+
Add any other context or screenshots about the feature request here.

.github/renovate.json5

Lines changed: 43 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,56 @@
11
{
2-
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"branchPrefix": "renovate/",
4-
"labels": ["renovate", "renovate/{{replace '.*/' '' depName}}", "renovate/{{updateType}}"],
5-
"packageRules": [
6-
{
7-
"matchUpdateTypes": ["patch"],
8-
"automergeType": "branch",
9-
// Do not wait for tests - this will speed up the whole process - updating many branches + running many tests
10-
"ignoreTests": true,
11-
"automerge": true,
12-
},
13-
{
14-
"description": "Ignore frequent renovate updates",
15-
"matchPackageNames": ["renovatebot/github-action"],
16-
"matchUpdateTypes": ["patch"],
17-
"enabled": false
18-
},
2+
$schema: "https://docs.renovatebot.com/renovate-schema.json",
3+
extends: [
4+
":disableDependencyDashboard",
5+
":docker",
6+
":disableRateLimiting",
7+
":enableVulnerabilityAlertsWithLabel(security)",
8+
"config:recommended",
9+
"docker:pinDigests",
10+
"helpers:pinGitHubActionDigestsToSemver",
11+
"security:openssf-scorecard",
12+
],
13+
"git-submodules": {
14+
enabled: true,
15+
},
16+
labels: [
17+
"renovate",
18+
"renovate/{{replace '.*/' '' depName}}",
19+
"renovate/{{updateType}}",
20+
],
21+
lockFileMaintenance: {
22+
enabled: true,
23+
schedule: ["before 6am on Sunday"],
24+
},
25+
packageRules: [
1926
{
20-
"matchPackageNames": ["renovatebot/github-action"],
21-
"matchUpdateTypes": ["minor"],
22-
"automergeType": "branch",
23-
"automerge": true,
24-
"ignoreTests": true,
25-
"schedule": ["* 0,2,4 1-7 * 0"],
27+
matchUpdateTypes: ["major"],
28+
automerge: false,
2629
},
2730
{
28-
"description": "Update all github-actions by default",
29-
"matchManagers": ["github-actions"],
30-
"automergeType": "branch",
31-
"automerge": true,
31+
description: "Ignore frequent renovate updates",
32+
enabled: false,
33+
matchPackageNames: ["renovatebot/github-action"],
34+
matchUpdateTypes: ["patch"],
3235
},
3336
{
34-
"matchManagers": ["git-submodules"],
35-
"matchUpdateTypes": ["digest"],
36-
"automerge": true,
37-
"automergeType": "branch",
37+
description: "Update renovatebot/github-action minor updates on Sundays",
38+
matchPackageNames: ["renovatebot/github-action"],
39+
matchUpdateTypes: ["minor"],
40+
schedule: ["* * * * 0"],
3841
},
3942
],
40-
"prBodyTemplate": "{{{table}}}{{{notes}}}{{{changelogs}}}",
41-
"rebaseWhen": "behind-base-branch",
42-
"regexManagers": [
43+
prBodyTemplate: "{{{table}}}{{{notes}}}{{{changelogs}}}",
44+
rebaseWhen: "behind-base-branch",
45+
regexManagers: [
4346
{
44-
"fileMatch": [
45-
"^\\.github/workflows/.*\\.ya?ml$",
46-
"^ansible/win-simple\\.yml$",
47+
extractVersionTemplate: "{{#if extractVersion}}{{{extractVersion}}}{{else}}^v?(?<version>.+)${{/if}}",
48+
fileMatch: ["\\.ya?ml$", "\\.md$", "^Dockerfile$", "^entrypoint\\.sh$"],
49+
matchStrings: [
50+
'# renovate: datasource=(?<datasource>.+?) depName=(?<depName>.+?)( versioning=(?<versioning>.+?))?( extractVersion=(?<extractVersion>.+?))?( registryUrl=(?<registryUrl>.+?))?\\s.*[=:]\\s*"?(?<currentValue>.+?)"?\\s',
4751
],
48-
"matchStrings": [
49-
"# renovate: datasource=(?<datasource>.+?) depName=(?<depName>.+?)( versioning=(?<versioning>.+?))?( extractVersion=(?<extractVersion>.+?))?( registryUrl=(?<registryUrl>.+?))?\\s.*[=:]\\s*\"?(?<currentValue>.+?)\"?\\s",
50-
],
51-
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}",
52-
"extractVersionTemplate": "{{#if extractVersion}}{{{extractVersion}}}{{else}}^v?(?<version>.+)${{/if}}",
52+
versioningTemplate: "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}",
5353
},
5454
],
55-
"git-submodules": {
56-
"enabled": true
57-
},
58-
"separateMinorPatch": true,
55+
separateMinorPatch: true,
5956
}

.github/workflows/commitlint.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/lint-pr-title.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/mega-linter.yml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: MegaLinter
23

34
on:
@@ -12,40 +13,32 @@ jobs:
1213
build:
1314
name: MegaLinter
1415
runs-on: ubuntu-latest
15-
permissions:
16-
contents: write
17-
statuses: write
1816
steps:
1917
- name: Checkout Code
20-
uses: actions/checkout@v4
18+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
19+
20+
- name: Restore lychee cache
21+
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
22+
with:
23+
path: .lycheecache
24+
key: cache-lychee-${{ github.sha }}
25+
restore-keys: cache-lychee-
2126

2227
- name: Extract commands from markdown files
2328
run: |
2429
set -euxo pipefail
2530
echo '#!/usr/bin/env bash' > README.sh
2631
find . -name '*.md' -print0 | while IFS= read -r -d '' FILE ; do
27-
sed -n "/^\`\`\`\(bash\|shell\).*/,/^\`\`\`$/p" "${FILE}" \
28-
| \
29-
sed \
30-
-e 's/^```\(bash\|shell\).*//' \
31-
-e '/^```$/d' \
32-
>> README.sh
32+
# Extract: ```bash ... ```
33+
sed -n "/^\`\`\`\(bash\|shell\)$/,/^\`\`\`$/p" "${FILE}" | sed '/^```*/d' >> README.sh
34+
# Extract: ```bash ... ```
35+
sed -n "/^ \`\`\`\(bash\|shell\)$/,/^ \`\`\`$/p" "${FILE}" | sed '/^ ```*/d; s/^ //' >> README.sh
3336
done
3437
chmod a+x README.sh
3538
36-
- name: MegaLinter
37-
uses: megalinter/megalinter@v7.1.0
39+
- name: 💡 MegaLinter
40+
uses: oxsecurity/megalinter@688bc7466d7ab4faa83d614c2e6f9acf42b674dc # v7.8.0
3841
env:
39-
ANSIBLE_ANSIBLE_LINT_PRE_COMMANDS: >-
40-
[{"command": "ansible-galaxy collection install -v -r ansible/requirements.yml"}]
41-
BASH_SHFMT_ARGUMENTS: --indent 2 --space-redirects
42-
DISABLE_LINTERS: COPYPASTE_JSCPD,JSON_PRETTIER,MARKDOWN_MARKDOWN_LINK_CHECK,REPOSITORY_DEVSKIM,REPOSITORY_SEMGREP,SPELL_CSPELL,SPELL_PROSELINT,YAML_V8R
43-
FILTER_REGEX_EXCLUDE: '(.*\.ps1|CHANGELOG.md)'
44-
FORMATTERS_DISABLE_ERRORS: false
4542
GITHUB_COMMENT_REPORTER: false
4643
GITHUB_STATUS_REPORTER: true
4744
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48-
PRINT_ALPACA: false
49-
REPOSITORY_KICS_ARGUMENTS: --exclude-paths .github/workflows/renovate.yml
50-
# Needed for scanning generated README.sh file
51-
VALIDATE_ALL_CODEBASE: true

.github/workflows/packer-templates.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
name: packer-templates
22

33
on:
4-
push:
5-
branches-ignore:
6-
- main
7-
paths:
8-
- "*.json"
9-
- .github/workflows/packer-templates.yml
4+
workflow_dispatch:
5+
# push:
6+
# branches-ignore:
7+
# - main
8+
# paths:
9+
# - "*.json"
10+
# - .github/workflows/packer-templates.yml
1011

1112
permissions: read-all
1213

@@ -20,9 +21,13 @@ jobs:
2021

2122
- name: Download Packer
2223
run: |
24+
set -euxo pipefail
25+
2326
PACKER_LATEST_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/packer | jq -r -M '.current_version')
2427
curl -s "https://releases.hashicorp.com/packer/${PACKER_LATEST_VERSION}/packer_${PACKER_LATEST_VERSION}_linux_amd64.zip" --output /tmp/packer_linux_amd64.zip
2528
sudo unzip -o /tmp/packer_linux_amd64.zip -d /usr/local/bin/
29+
packer plugins install github.com/hashicorp/qemu
30+
packer plugins install github.com/hashicorp/ansible
2631
2732
- name: Validate Packer templates
2833
run: |

0 commit comments

Comments
 (0)