Skip to content

Commit 92c59d3

Browse files
dependabot[bot]neilime
authored andcommitted
chore: fix lint issues
Signed-off-by: Emilien Escalle <[email protected]>
1 parent 36a8f56 commit 92c59d3

18 files changed

Lines changed: 111 additions & 54 deletions

File tree

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ updates:
33
- package-ecosystem: docker
44
open-pull-requests-limit: 20
55
directory: "/"
6+
cooldown:
7+
default-days: 7
68
schedule:
79
interval: weekly
810
day: friday
@@ -17,6 +19,8 @@ updates:
1719
directories:
1820
- "/"
1921
- "/actions/**/*"
22+
cooldown:
23+
default-days: 7
2024
schedule:
2125
interval: weekly
2226
day: friday
@@ -29,6 +33,8 @@ updates:
2933
- package-ecosystem: npm
3034
open-pull-requests-limit: 20
3135
directory: "/actions/parse-ci-reports"
36+
cooldown:
37+
default-days: 7
3238
schedule:
3339
interval: weekly
3440
day: friday
@@ -41,6 +47,8 @@ updates:
4147
- package-ecosystem: "devcontainers"
4248
open-pull-requests-limit: 20
4349
directory: "/"
50+
cooldown:
51+
default-days: 7
4452
schedule:
4553
interval: weekly
4654
day: friday

.github/workflows/greetings.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ name: Greetings
99
on:
1010
issues:
1111
types: [opened]
12-
pull_request_target:
12+
pull_request:
13+
types: [opened]
1314
branches: [main]
1415

1516
workflow_call:

.github/workflows/semantic-pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
name: "Semantic Pull Request"
88

99
on:
10-
pull_request_target:
10+
pull_request:
1111
types:
1212
- opened
1313
- edited

actions/checkout/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ runs:
3939
fetch-depth: ${{ inputs.fetch-depth }}
4040
lfs: ${{ inputs.lfs }}
4141
token: ${{ inputs.token || github.token }}
42-
persist-credentials: ${{ inputs.persist-credentials }}
42+
persist-credentials: ${{ inputs.persist-credentials == 'true' && 'true' || 'false' }}
4343

4444
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
4545
if: github.event_name != 'issue_comment'
4646
with:
4747
fetch-depth: ${{ inputs.fetch-depth }}
4848
lfs: ${{ inputs.lfs }}
4949
token: ${{ inputs.token || github.token }}
50-
persist-credentials: ${{ inputs.persist-credentials }}
50+
persist-credentials: ${{ inputs.persist-credentials == 'true' && 'true' || 'false' }}

actions/create-and-merge-pull-request/action.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,25 @@ runs:
6262
- id: wait-for-pull-request-mergeable-by-admin
6363
if: steps.create-pull-request.outputs.pull-request-number && steps.create-pull-request.outputs.pull-request-operation != 'closed'
6464
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
65+
env:
66+
PULL_REQUEST_NUMBER: ${{ steps.create-pull-request.outputs.pull-request-number }}
6567
with:
6668
github-token: ${{ inputs.github-token }}
6769
script: |
6870
let attemps = 0;
6971
const maxAttemps = 10;
72+
73+
const pullNumberRaw = process.env.PULL_REQUEST_NUMBER ?? '';
74+
if (!/^[0-9]+$/.test(pullNumberRaw)) {
75+
throw new Error(`Invalid pull request number: ${pullNumberRaw}`);
76+
}
77+
const pullNumber = Number.parseInt(pullNumberRaw, 10);
78+
7079
while (attemps < maxAttemps) {
7180
const { data: { mergeable, mergeable_state } } = await github.rest.pulls.get({
7281
owner: context.repo.owner,
7382
repo: context.repo.repo,
74-
pull_number: ${{ steps.create-pull-request.outputs.pull-request-number }},
83+
pull_number: pullNumber,
7584
});
7685
7786
if (mergeable === true) {
@@ -92,16 +101,22 @@ runs:
92101
shell: bash
93102
env:
94103
GH_TOKEN: ${{ inputs.github-token }}
104+
PULL_REQUEST_NUMBER: ${{ steps.create-pull-request.outputs.pull-request-number }}
95105
run: |
96106
set +e
97107
108+
if ! [[ "$PULL_REQUEST_NUMBER" =~ ^[0-9]+$ ]]; then
109+
echo "::error::Invalid pull request number: $PULL_REQUEST_NUMBER"
110+
exit 1
111+
fi
112+
98113
ATTEMPS=0
99114
MAX_ATTEMPS=10
100115
REQUIRED_WORKFLOWS_ERROR="Required workflow"
101116
102117
while [ $ATTEMPS -lt $MAX_ATTEMPS ]; do
103-
echo "::debug::Merging pull request #${{ steps.create-pull-request.outputs.pull-request-number }} for repository ${{ github.repository }}..."
104-
MERGE_OUTPUTS=$(gh pr merge -R "${{ github.repository }}" --rebase --admin "${{ steps.create-pull-request.outputs.pull-request-number }}" 2>&1)
118+
echo "::debug::Merging pull request #${PULL_REQUEST_NUMBER} for repository ${{ github.repository }}..."
119+
MERGE_OUTPUTS=$(gh pr merge -R "${{ github.repository }}" --rebase --admin "${PULL_REQUEST_NUMBER}" 2>&1)
105120
MERGE_EXIT_CODE=$?
106121
echo "::debug::Merge outputs: $MERGE_OUTPUTS"
107122
echo "::debug::Merge exit code: $MERGE_EXIT_CODE"

actions/get-matrix-outputs/action.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,22 @@ runs:
2424
using: "composite"
2525
steps:
2626
- id: prepare-download
27-
shell: bash
28-
run: |
29-
# Forge the unique artifact name for the current workflow
30-
ARTIFACT_NAME="${{ github.run_id }}-${{ github.run_number }}-${{ inputs.artifact-name }}"
31-
echo "artifact-name=$ARTIFACT_NAME" >> "$GITHUB_OUTPUT"
27+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
28+
env:
29+
ARTIFACT_NAME_INPUT: ${{ inputs.artifact-name }}
30+
with:
31+
script: |
32+
const path = require('node:path');
33+
const runId = process.env.GITHUB_RUN_ID ?? '';
34+
const runNumber = process.env.GITHUB_RUN_NUMBER ?? '';
35+
const artifactNameInput = process.env.ARTIFACT_NAME_INPUT ?? '';
36+
37+
// Forge the unique artifact name for the current workflow
38+
const artifactName = `${runId}-${runNumber}-${artifactNameInput}`;
39+
core.setOutput('artifact-name', artifactName);
3240
33-
ARTIFACT_PATH="/tmp/$ARTIFACT_NAME"
34-
echo "artifact-path=$ARTIFACT_PATH" >> "$GITHUB_OUTPUT"
41+
const artifactPath = path.join(process.env.RUNNER_TEMP, artifactName);
42+
core.setOutput('artifact-path', artifactPath);
3543
3644
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
3745
with:
@@ -41,11 +49,14 @@ runs:
4149

4250
- id: read-artifacts
4351
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
52+
env:
53+
ARTIFACT_PATH: ${{ steps.prepare-download.outputs.artifact-path }}
54+
REMOVE_ARTIFACT: ${{ inputs.remove-artifact }}
4455
with:
4556
script: |
4657
const { readFileSync } = require('fs');
4758
48-
const artifactPath = `${{ steps.prepare-download.outputs.artifact-path }}`;
59+
const artifactPath = process.env.ARTIFACT_PATH;
4960
const globber = await glob.create(`${artifactPath}/*.json`, {followSymbolicLinks: false});
5061
const artifactFiles = await globber.glob();
5162
@@ -58,7 +69,7 @@ runs:
5869
5970
core.setOutput('artifacts',`[${result}]`);
6071
61-
const shouldRemoveArtifact = `${{ inputs.remove-artifact }}` === 'true';
72+
const shouldRemoveArtifact = (process.env.REMOVE_ARTIFACT || '').toLowerCase() === 'true';
6273
if(shouldRemoveArtifact) {
6374
await io.rmRF(artifactPath);
6475
}

actions/parse-ci-reports/src/formatters/SummaryFormatter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export class SummaryFormatter extends MarkdownFormatter {
125125
// Overall percentage with visual indicator
126126
const overall = coverage.getOverallPercentage();
127127
output += `**Overall Coverage: ${this._formatPercentage(overall)}**\n`;
128-
output += this._getCoverageBar(overall) + "\n";
128+
output += `${this._getCoverageBar(overall)}\n`;
129129

130130
return output;
131131
}

actions/parse-ci-reports/src/parsers/AstroCheckParser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const ANSI_PATTERN = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`, "g");
1212
* Parser for output generated by `astro check`
1313
*/
1414
export class AstroCheckParser extends BaseParser {
15-
canParse(filePath, content) {
15+
canParse(_filePath, content) {
1616
if (!content) {
1717
return false;
1818
}
@@ -90,7 +90,7 @@ export class AstroCheckParser extends BaseParser {
9090
const severity = locationMatch[3].toLowerCase();
9191

9292
const remainderStart = locationMatch.index + locationMatch[0].length;
93-
let remainder = line.slice(remainderStart).trim();
93+
const remainder = line.slice(remainderStart).trim();
9494

9595
let rule = "astro-check";
9696
let message = remainder;

actions/parse-ci-reports/src/parsers/BaseParser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class BaseParser {
1919
* @returns {ReportData} Parsed report data
2020
*/
2121
// eslint-disable-next-line no-unused-vars
22-
parse(content, filePath) {
22+
parse(_content, _filePath) {
2323
throw new Error("parse() must be implemented by subclass");
2424
}
2525

@@ -30,7 +30,7 @@ export class BaseParser {
3030
* @returns {boolean} True if this parser can handle the file
3131
*/
3232
// eslint-disable-next-line no-unused-vars
33-
canParse(filePath, content) {
33+
canParse(_filePath, _content) {
3434
throw new Error("canParse() must be implemented by subclass");
3535
}
3636

actions/parse-ci-reports/src/parsers/CheckStyleParser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ export class CheckStyleParser extends BaseParser {
7474
for (const error of errors) {
7575
const issue = new LintIssue({
7676
file: fileName,
77-
line: parseInt(error["@_line"] || 0),
78-
column: parseInt(error["@_column"] || 0),
77+
line: parseInt(error["@_line"] || 0, 10),
78+
column: parseInt(error["@_column"] || 0, 10),
7979
severity: this._mapSeverity(error["@_severity"]),
8080
rule: error["@_source"] || "unknown",
8181
message: error["@_message"] || "",

0 commit comments

Comments
 (0)