mega-linter-runner 9.0.2-beta202510062016.0 → 9.0.2-beta202510070454.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generators/mega-linter-custom-flavor/index.js +7 -2
- package/generators/mega-linter-custom-flavor/templates/README.md +49 -5
- package/generators/mega-linter-custom-flavor/templates/check-new-megalinter-version.yml +281 -0
- package/generators/mega-linter-custom-flavor/templates/megalinter-custom-flavor-builder.yml +41 -3
- package/package.json +1 -1
|
@@ -84,7 +84,7 @@ Example: 'megalinter-custom-flavor-python-light'
|
|
|
84
84
|
|
|
85
85
|
writing() {
|
|
86
86
|
this._generateFlavorConfig();
|
|
87
|
-
this.
|
|
87
|
+
this._generateGitHubWorkflows();
|
|
88
88
|
this._generateGitHubAction();
|
|
89
89
|
this._generateReadme();
|
|
90
90
|
}
|
|
@@ -132,12 +132,17 @@ Example: 'megalinter-custom-flavor-python-light'
|
|
|
132
132
|
);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
_generateGitHubWorkflows() {
|
|
136
136
|
this.fs.copyTpl(
|
|
137
137
|
this.templatePath("megalinter-custom-flavor-builder.yml"),
|
|
138
138
|
this.destinationPath("./.github/workflows/megalinter-custom-flavor-builder.yml"),
|
|
139
139
|
{}
|
|
140
140
|
);
|
|
141
|
+
this.fs.copyTpl(
|
|
142
|
+
this.templatePath("check-new-megalinter-version.yml"),
|
|
143
|
+
this.destinationPath("./.github/workflows/check-new-megalinter-version.yml"),
|
|
144
|
+
{}
|
|
145
|
+
);
|
|
141
146
|
}
|
|
142
147
|
|
|
143
148
|
_generateGitHubAction() {
|
|
@@ -8,11 +8,55 @@ It is built from official MegaLinter images, but is maintained on <%= CUSTOM_FLA
|
|
|
8
8
|
|
|
9
9
|
<%= CUSTOM_FLAVOR_LINTERS_WITH_LINKS %>
|
|
10
10
|
|
|
11
|
-
## How to
|
|
11
|
+
## How to use the custom flavor
|
|
12
|
+
|
|
13
|
+
Follow [MegaLinter installation guide](https://megalinter.io/latest/install-assisted/), and replace related elements in the workflow.
|
|
14
|
+
|
|
15
|
+
- GitHub Action: On MegaLinter step in .github/workflows/mega-linter.yml, define `uses: <%= CUSTOM_FLAVOR_GITHUB_ACTION %>@main`
|
|
16
|
+
- Docker image: Replace official MegaLinter image with `<%= DOCKER_IMAGE_VERSION %>`
|
|
17
|
+
|
|
18
|
+
## How the flavor is generated and updated
|
|
19
|
+
|
|
20
|
+
This custom flavor is automatically kept up to date with MegaLinter releases:
|
|
21
|
+
|
|
22
|
+
1. **Automatic version sync**: The `check-new-megalinter-version` workflow runs daily, checks for new MegaLinter releases, and automatically creates matching releases in this repository.
|
|
23
|
+
|
|
24
|
+
2. **Automated builds**: Each release triggers the `megalinter-custom-flavor-builder` workflow, which:
|
|
25
|
+
- Builds a Docker image with only the selected linters
|
|
26
|
+
- Publishes to GitHub Container Registry (ghcr.io)
|
|
27
|
+
- Optionally publishes to Docker Hub (if credentials are configured)
|
|
12
28
|
|
|
13
|
-
|
|
29
|
+
3. **Available image tags**:
|
|
30
|
+
- Release tags (e.g., `v9.0.0`): Built from MegaLinter releases
|
|
31
|
+
- `beta` tag: Built from non-main branch pushes for testing
|
|
32
|
+
- `latest` tag: Points to the most recent release
|
|
14
33
|
|
|
15
|
-
|
|
34
|
+
## Configuration requirements
|
|
35
|
+
|
|
36
|
+
### Required: Personal Access Token
|
|
37
|
+
|
|
38
|
+
For automatic version checking to work, a `PAT_TOKEN` secret must be configured as a **repository-scoped fine-grained token** with:
|
|
39
|
+
- **Repository access**: Only select repositories (select this repository)
|
|
40
|
+
- **Repository permissions**:
|
|
41
|
+
- Contents: Read and write
|
|
42
|
+
- Actions: Read and write
|
|
43
|
+
|
|
44
|
+
See the [Custom Flavors documentation](https://megalinter.io/beta/custom-flavors/) for detailed setup instructions.
|
|
45
|
+
|
|
46
|
+
### Optional: Docker Hub publishing
|
|
47
|
+
|
|
48
|
+
To publish to Docker Hub in addition to ghcr.io, configure:
|
|
49
|
+
- `DOCKERHUB_REPO` variable (e.g., your Docker Hub username)
|
|
50
|
+
- `DOCKERHUB_USERNAME` secret
|
|
51
|
+
- `DOCKERHUB_PASSWORD` secret
|
|
52
|
+
|
|
53
|
+
## How to generate the flavor manually
|
|
54
|
+
|
|
55
|
+
If you need to manually trigger a build:
|
|
56
|
+
|
|
57
|
+
1. **Create a GitHub release**: Creates a versioned build matching the tag name (e.g., `v9.0.0`)
|
|
58
|
+
2. **Push to any branch** (except main): Builds a `beta` tagged image for testing
|
|
59
|
+
3. **Manually run the workflow**: Go to Actions > Build & Push MegaLinter Custom Flavor > Run workflow
|
|
16
60
|
|
|
17
61
|
See [full Custom Flavors documentation](https://megalinter.io/beta/custom-flavors/).
|
|
18
62
|
|
|
@@ -20,7 +64,7 @@ See [full Custom Flavors documentation](https://megalinter.io/beta/custom-flavor
|
|
|
20
64
|
|
|
21
65
|
Follow [MegaLinter installation guide](https://megalinter.io/latest/install-assisted/), and replace related elements in the workflow.
|
|
22
66
|
|
|
23
|
-
- GitHub Action
|
|
24
|
-
- Docker image
|
|
67
|
+
- **GitHub Action**: On MegaLinter step in `.github/workflows/mega-linter.yml`, define `uses: <%= CUSTOM_FLAVOR_GITHUB_ACTION %>@main`
|
|
68
|
+
- **Docker image**: Replace official MegaLinter image with `<%= DOCKER_IMAGE_VERSION %>`
|
|
25
69
|
|
|
26
70
|
[](https://www.ox.security/?ref=megalinter)
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# =============================================================
|
|
2
|
+
# Check for New MegaLinter Version Workflow
|
|
3
|
+
#
|
|
4
|
+
# This workflow checks daily for new versions of the MegaLinter
|
|
5
|
+
# custom-builder action and creates a release if a new version is found.
|
|
6
|
+
#
|
|
7
|
+
# Usage:
|
|
8
|
+
# - Runs daily at 00:00 UTC via schedule
|
|
9
|
+
# - Can be manually triggered via workflow_dispatch
|
|
10
|
+
# - Compares MegaLinter tags with current repository tags
|
|
11
|
+
# - Creates a new release if a new MegaLinter version is detected
|
|
12
|
+
#
|
|
13
|
+
# The workflow will:
|
|
14
|
+
# 1. Fetch all tags from oxsecurity/megalinter repository
|
|
15
|
+
# 2. Fetch all tags from the current repository
|
|
16
|
+
# 3. Find new tags that exist in MegaLinter but not in current repo
|
|
17
|
+
# 4. Create a release with the new version tag
|
|
18
|
+
# 5. The release will trigger megalinter-custom-flavor-builder.yml
|
|
19
|
+
#
|
|
20
|
+
# Required permissions:
|
|
21
|
+
# - contents: write (to create releases and tags)
|
|
22
|
+
#
|
|
23
|
+
# Required repository secrets:
|
|
24
|
+
# - PAT_TOKEN: Personal Access Token with 'contents' and 'actions' permissions
|
|
25
|
+
# This is required to trigger the builder workflow. Without it, the workflow
|
|
26
|
+
# will fail and the release will be deleted (to be recreated once the token is set).
|
|
27
|
+
#
|
|
28
|
+
# To create a Fine-grained PAT (recommended - more secure):
|
|
29
|
+
# 1. Go to GitHub Settings > Developer settings > Personal access tokens > Fine-grained tokens
|
|
30
|
+
# 2. Click "Generate new token"
|
|
31
|
+
# 3. Give it a descriptive name (e.g., "MegaLinter Auto-Release")
|
|
32
|
+
# 4. Set expiration (e.g., 90 days or 1 year)
|
|
33
|
+
# 5. Under "Repository access", select "Only select repositories"
|
|
34
|
+
# 6. Choose this repository (megalinter-custom-flavor-npm-groovy-lint)
|
|
35
|
+
# 7. Under "Permissions" > "Repository permissions":
|
|
36
|
+
# - Contents: Read and write
|
|
37
|
+
# - Actions: Read and write
|
|
38
|
+
# 8. Click "Generate token" and copy the token
|
|
39
|
+
# 9. In your repository, go to Settings > Secrets and variables > Actions
|
|
40
|
+
# 10. Click "New repository secret"
|
|
41
|
+
# 11. Name: PAT_TOKEN, Value: paste your token
|
|
42
|
+
# =============================================================
|
|
43
|
+
|
|
44
|
+
name: Check for New MegaLinter Version
|
|
45
|
+
|
|
46
|
+
on:
|
|
47
|
+
schedule:
|
|
48
|
+
# Run daily at 00:00 UTC
|
|
49
|
+
- cron: "0 0 * * *"
|
|
50
|
+
workflow_dispatch:
|
|
51
|
+
|
|
52
|
+
permissions:
|
|
53
|
+
contents: write
|
|
54
|
+
|
|
55
|
+
jobs:
|
|
56
|
+
check-new-version:
|
|
57
|
+
name: Check for New MegaLinter Version
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
|
|
60
|
+
steps:
|
|
61
|
+
- name: Checkout Code
|
|
62
|
+
uses: actions/checkout@v4
|
|
63
|
+
with:
|
|
64
|
+
fetch-depth: 0
|
|
65
|
+
|
|
66
|
+
- name: Fetch MegaLinter Repository Tags
|
|
67
|
+
id: fetch-megalinter-tags
|
|
68
|
+
run: |
|
|
69
|
+
echo "Fetching tags from oxsecurity/megalinter..."
|
|
70
|
+
|
|
71
|
+
# Fetch all tags from MegaLinter repository (filtering for version tags only)
|
|
72
|
+
MEGALINTER_TAGS=$(git ls-remote --tags --refs https://github.com/oxsecurity/megalinter.git | \
|
|
73
|
+
grep -E 'refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$' | \
|
|
74
|
+
sed 's/.*refs\/tags\///' | \
|
|
75
|
+
sort -V | \
|
|
76
|
+
tail -n 20)
|
|
77
|
+
|
|
78
|
+
echo "Latest MegaLinter tags:"
|
|
79
|
+
echo "$MEGALINTER_TAGS"
|
|
80
|
+
|
|
81
|
+
# Get the latest tag
|
|
82
|
+
LATEST_MEGALINTER_TAG=$(echo "$MEGALINTER_TAGS" | tail -n 1)
|
|
83
|
+
echo "latest_tag=$LATEST_MEGALINTER_TAG" >> $GITHUB_OUTPUT
|
|
84
|
+
|
|
85
|
+
# Save all tags to a file
|
|
86
|
+
echo "$MEGALINTER_TAGS" > megalinter_tags.txt
|
|
87
|
+
|
|
88
|
+
- name: Fetch Current Repository Tags
|
|
89
|
+
id: fetch-repo-tags
|
|
90
|
+
run: |
|
|
91
|
+
echo "Fetching tags from current repository..."
|
|
92
|
+
|
|
93
|
+
# Fetch all version tags from current repository
|
|
94
|
+
REPO_TAGS=$(git tag -l 'v*' | sort -V)
|
|
95
|
+
|
|
96
|
+
echo "Current repository tags:"
|
|
97
|
+
echo "$REPO_TAGS"
|
|
98
|
+
|
|
99
|
+
# Get the latest tag from current repository
|
|
100
|
+
if [ -z "$REPO_TAGS" ]; then
|
|
101
|
+
LATEST_REPO_TAG=""
|
|
102
|
+
echo "No existing tags in repository"
|
|
103
|
+
else
|
|
104
|
+
LATEST_REPO_TAG=$(echo "$REPO_TAGS" | tail -n 1)
|
|
105
|
+
echo "Latest repository tag: $LATEST_REPO_TAG"
|
|
106
|
+
fi
|
|
107
|
+
|
|
108
|
+
echo "latest_repo_tag=$LATEST_REPO_TAG" >> $GITHUB_OUTPUT
|
|
109
|
+
|
|
110
|
+
- name: Find New Version
|
|
111
|
+
id: find-new-version
|
|
112
|
+
run: |
|
|
113
|
+
echo "Comparing versions..."
|
|
114
|
+
|
|
115
|
+
LATEST_MEGALINTER_TAG="${{ steps.fetch-megalinter-tags.outputs.latest_tag }}"
|
|
116
|
+
LATEST_REPO_TAG="${{ steps.fetch-repo-tags.outputs.latest_repo_tag }}"
|
|
117
|
+
|
|
118
|
+
echo "Latest MegaLinter tag: $LATEST_MEGALINTER_TAG"
|
|
119
|
+
echo "Latest repository tag: $LATEST_REPO_TAG"
|
|
120
|
+
|
|
121
|
+
# Function to compare semantic versions
|
|
122
|
+
version_greater_than() {
|
|
123
|
+
# Remove 'v' prefix for comparison
|
|
124
|
+
ver1="${1#v}"
|
|
125
|
+
ver2="${2#v}"
|
|
126
|
+
|
|
127
|
+
# Use sort -V to compare versions
|
|
128
|
+
if [ "$(printf '%s\n' "$ver1" "$ver2" | sort -V | tail -n1)" = "$ver1" ] && [ "$ver1" != "$ver2" ]; then
|
|
129
|
+
return 0 # ver1 > ver2
|
|
130
|
+
else
|
|
131
|
+
return 1 # ver1 <= ver2
|
|
132
|
+
fi
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
# Check if we should create a new release
|
|
136
|
+
if [ -z "$LATEST_REPO_TAG" ]; then
|
|
137
|
+
echo "No existing tags in repository. Will create release for $LATEST_MEGALINTER_TAG"
|
|
138
|
+
echo "new_version_found=true" >> $GITHUB_OUTPUT
|
|
139
|
+
echo "new_version=$LATEST_MEGALINTER_TAG" >> $GITHUB_OUTPUT
|
|
140
|
+
elif version_greater_than "$LATEST_MEGALINTER_TAG" "$LATEST_REPO_TAG"; then
|
|
141
|
+
echo "✅ New version found! $LATEST_MEGALINTER_TAG > $LATEST_REPO_TAG"
|
|
142
|
+
echo "new_version_found=true" >> $GITHUB_OUTPUT
|
|
143
|
+
echo "new_version=$LATEST_MEGALINTER_TAG" >> $GITHUB_OUTPUT
|
|
144
|
+
else
|
|
145
|
+
echo "ℹ️ No new version. Repository is up to date."
|
|
146
|
+
echo "new_version_found=false" >> $GITHUB_OUTPUT
|
|
147
|
+
fi
|
|
148
|
+
|
|
149
|
+
- name: Create Release for New Version
|
|
150
|
+
if: steps.find-new-version.outputs.new_version_found == 'true'
|
|
151
|
+
env:
|
|
152
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
153
|
+
NEW_VERSION: ${{ steps.find-new-version.outputs.new_version }}
|
|
154
|
+
run: |
|
|
155
|
+
echo "Creating release for version $NEW_VERSION..."
|
|
156
|
+
|
|
157
|
+
# Create a release using GitHub CLI (will also create the tag)
|
|
158
|
+
gh release create "$NEW_VERSION" \
|
|
159
|
+
--title "MegaLinter Custom Flavor $NEW_VERSION" \
|
|
160
|
+
--notes "Automated release to sync with MegaLinter version $NEW_VERSION.
|
|
161
|
+
|
|
162
|
+
This release was automatically created to build a custom MegaLinter flavor based on the upstream MegaLinter release $NEW_VERSION.
|
|
163
|
+
|
|
164
|
+
For more information about changes in this version, see the [MegaLinter changelog](https://github.com/oxsecurity/megalinter/releases/tag/$NEW_VERSION)." \
|
|
165
|
+
--latest
|
|
166
|
+
|
|
167
|
+
- name: Trigger Custom Flavor Builder Workflow
|
|
168
|
+
if: steps.find-new-version.outputs.new_version_found == 'true'
|
|
169
|
+
env:
|
|
170
|
+
# Use PAT_TOKEN if available, otherwise fall back to GITHUB_TOKEN
|
|
171
|
+
# Note: GITHUB_TOKEN doesn't have permission to trigger workflows
|
|
172
|
+
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
|
|
173
|
+
run: |
|
|
174
|
+
echo "Triggering megalinter-custom-flavor-builder workflow..."
|
|
175
|
+
|
|
176
|
+
NEW_VERSION="${{ steps.find-new-version.outputs.new_version }}"
|
|
177
|
+
|
|
178
|
+
# Trigger the workflow using GitHub CLI and capture output
|
|
179
|
+
set +e # Don't exit immediately on error
|
|
180
|
+
gh workflow run megalinter-custom-flavor-builder.yml \
|
|
181
|
+
--ref main \
|
|
182
|
+
--field megalinter-version="$NEW_VERSION" \
|
|
183
|
+
--field is-latest="true" \
|
|
184
|
+
2>&1 | tee workflow_trigger.log
|
|
185
|
+
EXIT_CODE=$?
|
|
186
|
+
set -e # Re-enable exit on error
|
|
187
|
+
|
|
188
|
+
# Check for errors in the output
|
|
189
|
+
if grep -q "could not create workflow dispatch event" workflow_trigger.log || \
|
|
190
|
+
grep -q "Resource not accessible by integration" workflow_trigger.log || \
|
|
191
|
+
grep -q "HTTP 403" workflow_trigger.log || \
|
|
192
|
+
[ $EXIT_CODE -ne 0 ]; then
|
|
193
|
+
|
|
194
|
+
echo "::error::❌ Failed to trigger workflow!"
|
|
195
|
+
echo ""
|
|
196
|
+
cat workflow_trigger.log
|
|
197
|
+
echo ""
|
|
198
|
+
|
|
199
|
+
if grep -q "Resource not accessible by integration" workflow_trigger.log || grep -q "HTTP 403" workflow_trigger.log; then
|
|
200
|
+
echo "::error::The workflow could not be triggered due to insufficient token permissions."
|
|
201
|
+
echo "::error::"
|
|
202
|
+
echo "::error::Deleting the release so it can be recreated once PAT_TOKEN is configured..."
|
|
203
|
+
|
|
204
|
+
# Delete the release and tag that was just created
|
|
205
|
+
gh release delete "$NEW_VERSION" --yes --cleanup-tag 2>&1 || echo "::warning::Could not delete release (it may not exist or already be deleted)"
|
|
206
|
+
|
|
207
|
+
echo "::error::"
|
|
208
|
+
echo "::error::⚠️ PAT_TOKEN is REQUIRED to create releases and trigger the builder workflow."
|
|
209
|
+
echo "::error::"
|
|
210
|
+
echo "::error::To fix this, create a Fine-grained Personal Access Token (recommended - more secure):"
|
|
211
|
+
echo "::error::1. Go to: https://github.com/settings/personal-access-tokens/new"
|
|
212
|
+
echo "::error::2. Token name: 'MegaLinter Auto-Release'"
|
|
213
|
+
echo "::error::3. Expiration: Choose 90 days or 1 year"
|
|
214
|
+
echo "::error::4. Repository access: Select 'Only select repositories'"
|
|
215
|
+
echo "::error::5. Choose repository: ${{ github.repository }}"
|
|
216
|
+
echo "::error::6. Repository permissions:"
|
|
217
|
+
echo "::error:: - Contents: Read and write"
|
|
218
|
+
echo "::error:: - Actions: Read and write"
|
|
219
|
+
echo "::error::7. Click 'Generate token' and copy it"
|
|
220
|
+
echo "::error::8. Go to: https://github.com/${{ github.repository }}/settings/secrets/actions"
|
|
221
|
+
echo "::error::9. Click 'New repository secret'"
|
|
222
|
+
echo "::error::10. Name: 'PAT_TOKEN', Value: paste your token"
|
|
223
|
+
echo "::error::"
|
|
224
|
+
echo "::error::Once configured, run this workflow again (manually or wait for the next scheduled run)."
|
|
225
|
+
fi
|
|
226
|
+
|
|
227
|
+
exit 1
|
|
228
|
+
fi
|
|
229
|
+
|
|
230
|
+
echo "✅ Builder workflow triggered successfully with version: $NEW_VERSION"
|
|
231
|
+
|
|
232
|
+
- name: Summary
|
|
233
|
+
if: always()
|
|
234
|
+
run: |
|
|
235
|
+
echo "## Check for New MegaLinter Version Summary" >> $GITHUB_STEP_SUMMARY
|
|
236
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
237
|
+
|
|
238
|
+
LATEST_MEGALINTER_TAG="${{ steps.fetch-megalinter-tags.outputs.latest_tag }}"
|
|
239
|
+
LATEST_REPO_TAG="${{ steps.fetch-repo-tags.outputs.latest_repo_tag }}"
|
|
240
|
+
|
|
241
|
+
if [ "${{ steps.find-new-version.outputs.new_version_found }}" == "true" ]; then
|
|
242
|
+
echo "✅ New version found: **${{ steps.find-new-version.outputs.new_version }}**" >> $GITHUB_STEP_SUMMARY
|
|
243
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
244
|
+
echo "A new release has been created, which will trigger the custom flavor builder workflow." >> $GITHUB_STEP_SUMMARY
|
|
245
|
+
|
|
246
|
+
# Check if PAT_TOKEN is configured
|
|
247
|
+
if [ -z "${{ secrets.PAT_TOKEN }}" ]; then
|
|
248
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
249
|
+
echo "### ⚠️ REQUIRED: Configure PAT_TOKEN" >> $GITHUB_STEP_SUMMARY
|
|
250
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
251
|
+
echo "**PAT_TOKEN is required to trigger the builder workflow and create releases.**" >> $GITHUB_STEP_SUMMARY
|
|
252
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
253
|
+
echo "Without it, releases will be automatically deleted and the workflow will fail." >> $GITHUB_STEP_SUMMARY
|
|
254
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
255
|
+
echo "**To create a Fine-grained Personal Access Token (recommended - more secure):**" >> $GITHUB_STEP_SUMMARY
|
|
256
|
+
echo "1. Go to [GitHub Settings > Personal access tokens > Fine-grained tokens](https://github.com/settings/personal-access-tokens/new)" >> $GITHUB_STEP_SUMMARY
|
|
257
|
+
echo "2. Token name: \`MegaLinter Auto-Release\`" >> $GITHUB_STEP_SUMMARY
|
|
258
|
+
echo "3. Expiration: Choose 90 days or 1 year" >> $GITHUB_STEP_SUMMARY
|
|
259
|
+
echo "4. Repository access: **Only select repositories**" >> $GITHUB_STEP_SUMMARY
|
|
260
|
+
echo "5. Choose repository: \`${{ github.repository }}\`" >> $GITHUB_STEP_SUMMARY
|
|
261
|
+
echo "6. Repository permissions:" >> $GITHUB_STEP_SUMMARY
|
|
262
|
+
echo " - **Contents**: Read and write" >> $GITHUB_STEP_SUMMARY
|
|
263
|
+
echo " - **Actions**: Read and write" >> $GITHUB_STEP_SUMMARY
|
|
264
|
+
echo "7. Click **Generate token** and copy it" >> $GITHUB_STEP_SUMMARY
|
|
265
|
+
echo "8. Go to [Repository Settings > Secrets](https://github.com/${{ github.repository }}/settings/secrets/actions)" >> $GITHUB_STEP_SUMMARY
|
|
266
|
+
echo "9. Click **New repository secret**" >> $GITHUB_STEP_SUMMARY
|
|
267
|
+
echo "10. Name: \`PAT_TOKEN\`, Value: paste your token" >> $GITHUB_STEP_SUMMARY
|
|
268
|
+
fi
|
|
269
|
+
else
|
|
270
|
+
echo "ℹ️ No new versions found. Repository is up to date with MegaLinter." >> $GITHUB_STEP_SUMMARY
|
|
271
|
+
fi
|
|
272
|
+
|
|
273
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
274
|
+
echo "**Version Comparison:**" >> $GITHUB_STEP_SUMMARY
|
|
275
|
+
echo "- Latest MegaLinter version: **$LATEST_MEGALINTER_TAG**" >> $GITHUB_STEP_SUMMARY
|
|
276
|
+
|
|
277
|
+
if [ -n "$LATEST_REPO_TAG" ]; then
|
|
278
|
+
echo "- Latest repository version: **$LATEST_REPO_TAG**" >> $GITHUB_STEP_SUMMARY
|
|
279
|
+
else
|
|
280
|
+
echo "- Latest repository version: **No tags found**" >> $GITHUB_STEP_SUMMARY
|
|
281
|
+
fi
|
|
@@ -30,6 +30,16 @@ on:
|
|
|
30
30
|
release:
|
|
31
31
|
types: [edited, published]
|
|
32
32
|
workflow_dispatch:
|
|
33
|
+
inputs:
|
|
34
|
+
megalinter-version:
|
|
35
|
+
description: "MegaLinter version to build (e.g., v7.5.0)"
|
|
36
|
+
required: false
|
|
37
|
+
type: string
|
|
38
|
+
is-latest:
|
|
39
|
+
description: "Mark this version as latest"
|
|
40
|
+
required: false
|
|
41
|
+
type: boolean
|
|
42
|
+
default: false
|
|
33
43
|
|
|
34
44
|
concurrency:
|
|
35
45
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
@@ -45,10 +55,38 @@ jobs:
|
|
|
45
55
|
|
|
46
56
|
steps:
|
|
47
57
|
- name: Checkout Code
|
|
48
|
-
uses: actions/checkout@
|
|
58
|
+
uses: actions/checkout@v4
|
|
49
59
|
with:
|
|
50
60
|
fetch-depth: 0
|
|
51
61
|
|
|
62
|
+
- name: Determine MegaLinter Version Tag
|
|
63
|
+
id: determine-tag
|
|
64
|
+
run: |
|
|
65
|
+
if [ -n "${{ inputs.megalinter-version }}" ]; then
|
|
66
|
+
TAG="${{ inputs.megalinter-version }}"
|
|
67
|
+
echo "Using workflow input version: $TAG"
|
|
68
|
+
elif [ "${{ github.event_name }}" == "release" ]; then
|
|
69
|
+
TAG="${{ github.event.release.tag_name }}"
|
|
70
|
+
echo "Using release tag: $TAG"
|
|
71
|
+
else
|
|
72
|
+
TAG="beta"
|
|
73
|
+
echo "Using default tag: $TAG"
|
|
74
|
+
fi
|
|
75
|
+
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
|
76
|
+
|
|
77
|
+
# Determine is-latest flag
|
|
78
|
+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
|
79
|
+
IS_LATEST="${{ inputs.is-latest }}"
|
|
80
|
+
echo "Using workflow input is-latest: $IS_LATEST"
|
|
81
|
+
elif [ "${{ github.event_name }}" == "release" ]; then
|
|
82
|
+
IS_LATEST="true"
|
|
83
|
+
echo "Release event - is-latest: true"
|
|
84
|
+
else
|
|
85
|
+
IS_LATEST="false"
|
|
86
|
+
echo "Default is-latest: false"
|
|
87
|
+
fi
|
|
88
|
+
echo "is-latest=$IS_LATEST" >> $GITHUB_OUTPUT
|
|
89
|
+
|
|
52
90
|
- name: Log in to GitHub Container Registry
|
|
53
91
|
uses: docker/login-action@v3
|
|
54
92
|
with:
|
|
@@ -68,8 +106,8 @@ jobs:
|
|
|
68
106
|
- name: Build MegaLinter Custom Flavor
|
|
69
107
|
uses: oxsecurity/megalinter/flavors/custom-builder@main
|
|
70
108
|
with:
|
|
71
|
-
megalinter-custom-flavor-builder-tag: ${{
|
|
72
|
-
is-latest: ${{
|
|
109
|
+
megalinter-custom-flavor-builder-tag: ${{ steps.determine-tag.outputs.tag }}
|
|
110
|
+
is-latest: ${{ steps.determine-tag.outputs.is-latest }}
|
|
73
111
|
upload-to-ghcr: "true"
|
|
74
112
|
upload-to-dockerhub: ${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_PASSWORD != '' && 'true' || 'false' }}
|
|
75
113
|
dockerhub-repo: ${{ vars.DOCKERHUB_REPO }}
|