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
6 changes: 2 additions & 4 deletions .github/workflows/codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ jobs:
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v4

# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@562ee3e92b8e92df8b67e0a5ff8aa8e261919c08 # v4.4.7
with:
Expand All @@ -61,6 +59,6 @@ jobs:

# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v3
uses: github/codeql-action/upload-sarif@5c8a8a642e79153f5d047b10ec1cba1d1cc65699 # v3
with:
sarif_file: results.sarif
14 changes: 5 additions & 9 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
analyze:
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
name: Analyze
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
Expand All @@ -46,11 +46,9 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -64,9 +62,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
uses: github/codeql-action/autobuild@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
Expand All @@ -77,6 +73,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
with:
category: "/language:${{matrix.language}}"
8 changes: 6 additions & 2 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,20 @@ on:
pull_request:
types: [opened, synchronize, reopened, edited]

permissions:
contents: read
pull-requests: write

jobs:
validate-pr-title:
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
runs-on: ubuntu-latest # Use the latest Ubuntu runner for the job
steps:
- name: Checkout code
uses: actions/checkout@v4 # Checkout the repository code using the actions/checkout action
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: PR Conventional Commit Validation
uses: ytanikin/PRConventionalCommits@1.1.0 # Use the PRConventionalCommits action to validate PR titles
uses: ytanikin/PRConventionalCommits@b7be9213c4fa33260646db6c9b905332dc90b310 # 1.1.0
with:
# Define the task types that are valid for conventional commits
task_types: '["build","ci","docs","feat","fix","perf","refactor","style","test","feat!"]'
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/dco-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ on: [pull_request]

jobs:
dco:
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
if: |
github.actor != 'dependabot[bot]' &&
github.actor != 'dependabot-preview[bot]' &&
github.actor != 'github-actions[bot]'
# Define the runner environment
runs-on: ubuntu-latest

steps:
# Step to check out the repository
- uses: actions/checkout@v4
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0 # Fetch all history for all branches to ensure complete commit history is available

Expand All @@ -43,7 +46,7 @@ jobs:
# Loop through each commit and check for the Signed-off-by line
for commit in $commits; do
# Check if the commit message contains the Signed-off-by line
if ! git show --quiet --format=%B $commit | grep -q "^Signed-off-by: "; then
if ! git show --quiet --format=%B "$commit" | grep -q "^Signed-off-by: "; then
# If not, add the commit hash to the list of non-compliant commits
non_compliant_commits="$non_compliant_commits $commit"
fi
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
uses: actions/dependency-review-action@2031cfc080254a8a887f58cffee85186f0e49e48 # v4.9.0
15 changes: 11 additions & 4 deletions .github/workflows/gpg-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest # Use the latest Ubuntu runner for the job
steps:
- uses: actions/checkout@v4 # Checkout the repository code using the actions/checkout action
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0 # Fetch all history for all branches to ensure we have the full commit history

Expand Down Expand Up @@ -44,11 +44,18 @@ jobs:

# Check the GPG verification status of each commit via the GitHub commit API
for commit in $commits; do
verified=$(curl -s \
response=$(curl -s --max-time 10 --fail \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/$GITHUB_REPOSITORY/commits/$commit \
| jq -r '.commit.verification.verified')
https://api.github.com/repos/$GITHUB_REPOSITORY/commits/$commit)
curl_exit=$?

if [[ $curl_exit -ne 0 ]]; then
echo "GitHub API request failed for commit $commit (curl exit $curl_exit). Check network or API availability."
exit 1
fi

verified=$(echo "$response" | jq -r '.commit.verification.verified')

# If the commit is not verified, list it and exit with a non-zero status
if [[ "$verified" != "true" ]]; then
Expand Down
18 changes: 2 additions & 16 deletions .github/workflows/milestone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,11 @@ jobs:
runs-on: ubuntu-latest

steps:
# Step to check out the repository code.
- name: Checkout Repository
uses: actions/checkout@v4

# Step to set up environment variables required for the script.
- name: Set up environment variables
run: |
# Set the GitHub token for authentication.
echo "ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
# Set the milestone number based on the workflow input.
echo "MILESTONE_NUMBER=${{ github.event.inputs.milestoneId }}" >> $GITHUB_ENV
# Set the base API URL for GitHub.
echo "API_URL=https://api.github.com" >> $GITHUB_ENV

# Step to close the specified milestone using GitHub API.
- name: Close Milestone
run: |
# Use the environment variables set up earlier to make the API call.
curl -X PATCH \
curl --fail -s -X PATCH \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{"state": "closed"}' \
Expand All @@ -51,7 +37,7 @@ jobs:

# Step to trigger another workflow for releasing, passing the milestone number.
- name: Trigger Release Workflow
uses: peter-evans/repository-dispatch@v1
uses: peter-evans/repository-dispatch@ce5485de42c9b2622d2ed064be479e8ed65e76f4 # v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/njsscan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ jobs:
name: njsscan code scanning
steps:
- name: Checkout the code
uses: actions/checkout@v4
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: nodejsscan scan
id: njsscan
continue-on-error: true
uses: ajinabraham/njsscan-action@d58d8b2f26322cd35a9efb8003baac517f226d81
with:
args: '. --sarif --output results.sarif || true'
args: '. --sarif --output results.sarif'
- name: Upload njsscan report
uses: github/codeql-action/upload-sarif@v3
uses: github/codeql-action/upload-sarif@5c8a8a642e79153f5d047b10ec1cba1d1cc65699 # v3
if: hashFiles('results.sarif') != ''
with:
sarif_file: results.sarif
12 changes: 6 additions & 6 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
Expand All @@ -50,9 +50,9 @@ jobs:
node-version: [20]
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Use Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
Expand All @@ -72,9 +72,9 @@ jobs:
node-version: [20]
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Use Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
Expand Down
29 changes: 20 additions & 9 deletions .github/workflows/package-rule-rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ jobs:

steps:
- name: Checkout rule repository
uses: actions/checkout@v4
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: '20'

Expand All @@ -80,8 +80,11 @@ jobs:

- name: Clone Rule Executer repository (dev branch)
run: |
git config --global url."https://x-access-token:${GH_TOKEN_LIB}@github.com/".insteadOf "https://github.com/"
git clone https://github.com/tazama-lf/rule-executer -b dev rule-executer
echo "Rule Executer clone complete."
env:
GH_TOKEN_LIB: ${{ secrets.GH_TOKEN_LIB }}

- name: Prepare rule-executer-${{ inputs.rule_number }}
run: |
Expand All @@ -101,14 +104,22 @@ jobs:
# "rule": "npm:@tazama-lf/rule-901@X.Y.Z"
# → for tazama-lf: keep @tazama-lf, change rule number and version
# → for frmscoe: switch namespace to @frmscoe, change rule number and version
if [ "$RULE_ORG" = "frmscoe" ]; then
sed -i "s|npm:@tazama-lf/rule-[^@]*@[^\"]*|npm:@frmscoe/rule-${RULE_NUM}@${VERSION}|g" "${RULE_DIR}/package.json"
else
sed -i "s|npm:@tazama-lf/rule-[^@]*@[^\"]*|npm:@tazama-lf/rule-${RULE_NUM}@${VERSION}|g" "${RULE_DIR}/package.json"
fi
case "$RULE_ORG" in
frmscoe)
EXPECTED_SCOPE="@frmscoe"
sed -i "s|npm:@tazama-lf/rule-[^@]*@[^\"]*|npm:@frmscoe/rule-${RULE_NUM}@${VERSION}|g" "${RULE_DIR}/package.json"
;;
tazama-lf)
EXPECTED_SCOPE="@tazama-lf"
sed -i "s|npm:@tazama-lf/rule-[^@]*@[^\"]*|npm:@tazama-lf/rule-${RULE_NUM}@${VERSION}|g" "${RULE_DIR}/package.json"
;;
*)
echo "::error::Unknown RULE_ORG value: '${RULE_ORG}'. Expected 'frmscoe' or 'tazama-lf'."
exit 1
;;
esac

# Validate rule dependency rewrite succeeded — fail if pattern didn't match
EXPECTED_SCOPE=$( [ "$RULE_ORG" = "frmscoe" ] && echo "@frmscoe" || echo "@tazama-lf" )
if ! grep -q "npm:${EXPECTED_SCOPE}/rule-${RULE_NUM}@${VERSION}" "${RULE_DIR}/package.json"; then
echo "❌ Failed to update rule dependency in package.json — pattern may have changed"
echo " Expected: npm:${EXPECTED_SCOPE}/rule-${RULE_NUM}@${VERSION}"
Expand Down Expand Up @@ -138,7 +149,7 @@ jobs:
- name: Install dependencies
run: |
cd "rule-executer-${{ inputs.rule_number }}"
npm ci
npm install
env:
GH_TOKEN: ${{ secrets.GH_TOKEN_LIB }}

Expand Down
29 changes: 20 additions & 9 deletions .github/workflows/package-rule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ jobs:

steps:
- name: Checkout rule repository
uses: actions/checkout@v4
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: '20'

Expand All @@ -83,8 +83,11 @@ jobs:

- name: Clone Rule Executer repository (main branch)
run: |
git config --global url."https://x-access-token:${GH_TOKEN_LIB}@github.com/".insteadOf "https://github.com/"
git clone https://github.com/tazama-lf/rule-executer -b main rule-executer
echo "Rule Executer clone complete."
env:
GH_TOKEN_LIB: ${{ secrets.GH_TOKEN_LIB }}

- name: Prepare rule-executer-${{ inputs.rule_number }}
run: |
Expand All @@ -101,14 +104,22 @@ jobs:
echo "Applying substitutions for rule-${RULE_NUM} (org: ${RULE_ORG}, version: ${VERSION})"

# Update rule dependency in package.json
if [ "$RULE_ORG" = "frmscoe" ]; then
sed -i "s|npm:@tazama-lf/rule-[^@]*@[^\"]*|npm:@frmscoe/rule-${RULE_NUM}@${VERSION}|g" "${RULE_DIR}/package.json"
else
sed -i "s|npm:@tazama-lf/rule-[^@]*@[^\"]*|npm:@tazama-lf/rule-${RULE_NUM}@${VERSION}|g" "${RULE_DIR}/package.json"
fi
case "$RULE_ORG" in
frmscoe)
EXPECTED_SCOPE="@frmscoe"
sed -i "s|npm:@tazama-lf/rule-[^@]*@[^\"]*|npm:@frmscoe/rule-${RULE_NUM}@${VERSION}|g" "${RULE_DIR}/package.json"
;;
tazama-lf)
EXPECTED_SCOPE="@tazama-lf"
sed -i "s|npm:@tazama-lf/rule-[^@]*@[^\"]*|npm:@tazama-lf/rule-${RULE_NUM}@${VERSION}|g" "${RULE_DIR}/package.json"
;;
*)
echo "::error::Unknown RULE_ORG value: '${RULE_ORG}'. Expected 'frmscoe' or 'tazama-lf'."
exit 1
;;
esac

# Validate rule dependency rewrite succeeded — fail if pattern didn't match
EXPECTED_SCOPE=$( [ "$RULE_ORG" = "frmscoe" ] && echo "@frmscoe" || echo "@tazama-lf" )
if ! grep -q "npm:${EXPECTED_SCOPE}/rule-${RULE_NUM}@${VERSION}" "${RULE_DIR}/package.json"; then
echo "❌ Failed to update rule dependency in package.json — pattern may have changed"
echo " Expected: npm:${EXPECTED_SCOPE}/rule-${RULE_NUM}@${VERSION}"
Expand Down Expand Up @@ -138,7 +149,7 @@ jobs:
- name: Install dependencies
run: |
cd "rule-executer-${{ inputs.rule_number }}"
npm ci
npm install
env:
GH_TOKEN: ${{ secrets.GH_TOKEN_LIB }}

Expand Down
Loading
Loading