Skip to content

Commit c115e37

Browse files
merge from main
2 parents 80d2dab + e5a2754 commit c115e37

6 files changed

Lines changed: 79 additions & 80 deletions

File tree

.github/dependabot.yml

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

.github/workflows/auto-merge-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ jobs:
1515
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN }}
1616
run: gh pr merge --auto --squash "$PR_URL"
1717
- name: Auto approve dependabot PRs
18-
uses: hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363 #v4
18+
uses: step-security/auto-approve-action@0c28339628c8e79ab2f6813291e7e6cd584b4d30 # v4.0.0
1919
with:
2020
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

.github/workflows/delete-packages-and-releases.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,42 @@ on:
1414
required: true
1515

1616
permissions:
17-
id-token: write
18-
contents: write
19-
packages: write
20-
17+
contents: read
2118

2219
jobs:
2320
delete:
21+
permissions:
22+
contents: write
23+
packages: write
2424
runs-on: cx-public-ubuntu-x64
2525
steps:
2626

2727
- name: Delete npm packages
2828
continue-on-error: true
29+
env:
30+
INPUT_TAG: ${{ inputs.tag }}
31+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2932
run: |
33+
echo "Deleting all npm packages whose name ends with '-${INPUT_TAG}.0'"
3034
31-
echo "Deleting all npm packages whose name ends with '-${{inputs.tag}}.0'"
32-
33-
VERSION_IDS=($(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/orgs/Checkmarx/packages/npm/ast-cli-javascript-wrapper-runtime-cli/versions | jq '.[]|select(.name | contains("-${{inputs.tag}}.0"))|.id'))
35+
VERSION_IDS=($(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GH_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/orgs/Checkmarx/packages/npm/ast-cli-javascript-wrapper-runtime-cli/versions | jq ".[]|select(.name | contains(\"-${INPUT_TAG}.0\"))|.id"))
3436
3537
for versionId in "${VERSION_IDS[@]}"
3638
do
3739
echo "Deleting version $versionId..."
38-
curl -L -X DELETE -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/orgs/Checkmarx/packages/npm/ast-cli-javascript-wrapper-runtime-cli/versions/$versionId"
40+
curl -L -X DELETE -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GH_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/orgs/Checkmarx/packages/npm/ast-cli-javascript-wrapper-runtime-cli/versions/$versionId"
3941
echo "Version $versionId deleted successfully!"
4042
done
4143
4244
- name: Delete releases and tags
4345
continue-on-error: true
44-
uses: dev-drprasad/delete-older-releases@dfbe6be2a006e9475dfcbe5b8d201f1824c2a9fe #v0.3.4
4546
env:
46-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47-
with:
48-
keep_latest: 0
49-
delete_tag_pattern: "-${{inputs.tag}}.0"
50-
delete_tags: true
47+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
INPUT_TAG: ${{ inputs.tag }}
49+
run: |
50+
gh release list --limit 100 --json tagName \
51+
--jq ".[] | select(.tagName | contains(\"-${INPUT_TAG}.0\")) | .tagName" \
52+
| while IFS= read -r tag; do
53+
echo "Deleting release and tag: $tag"
54+
gh release delete "$tag" --yes --cleanup-tag || true
55+
done

.github/workflows/dependabot-auto-merge.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- name: Dependabot metadata
1313
id: metadata
14-
uses: dependabot/fetch-metadata@dbb049abf0d677abbd7f7eee0375145b417fdd34 #v2.2.0
14+
uses: step-security/dependabot-fetch-metadata@bf8fb6e0be0a711c669dc236de6e7f7374ba626e # v3.1.0
1515
with:
1616
github-token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
1717
- name: Enable auto-merge for Dependabot PRs
@@ -20,6 +20,6 @@ jobs:
2020
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN }}
2121
run: gh pr merge --auto --squash "$PR_URL"
2222
- name: Auto approve dependabot PRs
23-
uses: hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363 #v4
23+
uses: step-security/auto-approve-action@0c28339628c8e79ab2f6813291e7e6cd584b4d30 # v4.0.0
2424
with:
2525
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

.github/workflows/release.yml

Lines changed: 56 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,32 @@ on:
3535
type: boolean
3636

3737
permissions:
38-
id-token: write
39-
contents: write
40-
packages: write
38+
contents: read
4139

4240
jobs:
4341
delete:
42+
permissions:
43+
contents: write
44+
packages: write
4445
uses: Checkmarx/ast-cli-javascript-wrapper-runtime-cli/.github/workflows/delete-packages-and-releases.yml@main
4546
with:
4647
tag: ${{ inputs.jsTag }}
4748
secrets: inherit
4849
if: inputs.dev == true
4950
release:
51+
permissions:
52+
id-token: write
53+
contents: write
54+
packages: write
5055
runs-on: cx-public-ubuntu-x64
5156
env:
52-
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5358
BRANCH_NAME: npm-version-patch
5459
outputs:
5560
TAG_NAME: ${{ steps.generate_tag_name.outputs.TAG_NAME }}
5661
CLI_VERSION: ${{ steps.extract_cli_version.outputs.CLI_VERSION }}
5762
steps:
58-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
63+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
5964
with:
6065
fetch-depth: 0
6166

@@ -64,36 +69,43 @@ jobs:
6469
git config user.name github-actions
6570
git config user.email github-actions@github.com
6671
67-
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
72+
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
6873
with:
6974
node-version: 22.11.0
7075
registry-url: https://npm.pkg.github.com/
7176

7277
- name: Generate Tag name
7378
id: generate_tag_name
79+
env:
80+
INPUT_DEV: ${{ inputs.dev }}
81+
INPUT_JS_TAG: ${{ inputs.jsTag }}
7482
run: |
75-
if [ "${{ inputs.dev }}" == "true" ]; then
76-
TAG_NAME=$(npm version prerelease --preid=${{ inputs.jsTag }} --no-git-tag-version --allow-same-version)
83+
if [ "$INPUT_DEV" == "true" ]; then
84+
TAG_NAME=$(npm version prerelease --preid="$INPUT_JS_TAG" --no-git-tag-version --allow-same-version)
7785
else
7886
TAG_NAME=$(npm version patch --no-git-tag-version)
7987
fi
80-
88+
8189
echo "Generated TAG_NAME: $TAG_NAME"
8290
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
83-
echo "::set-output name=TAG_NAME::$TAG_NAME"
91+
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_OUTPUT
8492
8593
- name: Extract CLI version
8694
id: extract_cli_version
8795
run: |
8896
CLI_VERSION=$(cat checkmarx-ast-cli.version | grep -Eo '^[0-9]+\.[0-9]+\.[0-9]+')
8997
echo "CLI version being packed is $CLI_VERSION"
9098
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
91-
echo "::set-output name=CLI_VERSION::$CLI_VERSION"
99+
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_OUTPUT
92100
93101
- name: Check if CLI version is latest
94102
id: check_latest_cli_version
103+
env:
104+
INPUT_DEV: ${{ inputs.dev }}
105+
INPUT_CLI_TAG: ${{ inputs.cliTag }}
106+
GIT_REF: ${{ github.ref }}
95107
run: |
96-
if [ "${{ inputs.dev }}" == "false" ] || [ -n "${{ inputs.cliTag }}" ] || [ "${{ github.ref }}" != "refs/heads/main" ]; then
108+
if [ "$INPUT_DEV" == "false" ] || [ -n "$INPUT_CLI_TAG" ] || [ "$GIT_REF" != "refs/heads/main" ]; then
97109
exit 0
98110
fi
99111
@@ -113,7 +125,7 @@ jobs:
113125
- name: Create Pull Request
114126
id: create_pr
115127
if: inputs.dev == false
116-
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c #v6.1.0
128+
uses: step-security/create-pull-request@50c103da2b9ca12cd5bc013fc6931051a5aa872b # v8.1.1
117129
with:
118130
token: ${{ env.GITHUB_TOKEN }}
119131
branch: ${{ env.BRANCH_NAME }}
@@ -125,13 +137,13 @@ jobs:
125137
- name: Wait for PR to be created
126138
id: pr
127139
if: inputs.dev == false
128-
uses: octokit/request-action@872c5c97b3c85c23516a572f02b31401ef82415d #v2.3.1
140+
uses: octokit/request-action@b91aabaa861c777dcdb14e2387e30eddf04619ae # v3.0.0
129141
with:
130142
route: GET /repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:${{ env.BRANCH_NAME }}
131143

132144
- name: Merge Pull Request
133145
if: inputs.dev == false
134-
uses: octokit/request-action@872c5c97b3c85c23516a572f02b31401ef82415d #v2.3.1
146+
uses: octokit/request-action@b91aabaa861c777dcdb14e2387e30eddf04619ae # v3.0.0
135147
with:
136148
route: PUT /repos/${{ github.repository }}/pulls/${{ steps.create_pr.outputs.pull-request-number }}/merge
137149
merge_method: squash
@@ -144,43 +156,45 @@ jobs:
144156
git push --tags
145157
146158
- name: Publish npm package
159+
env:
160+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
161+
INPUT_DEV: ${{ inputs.dev }}
162+
INPUT_JS_TAG: ${{ inputs.jsTag }}
147163
run: |
148-
if [ ${{ inputs.dev }} == true ]; then
149-
npm publish --tag=${{ inputs.jsTag }}
164+
if [ "$INPUT_DEV" == "true" ]; then
165+
npm publish --tag="$INPUT_JS_TAG"
150166
else
151167
npm publish --access public
152168
fi
153-
env:
154-
NODE_AUTH_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}
155169
156170
- name: Create Release
157-
uses: softprops/action-gh-release@a74c6b72af54cfa997e81df42d94703d6313a2d0 #v2
171+
uses: step-security/action-gh-release@277bfa82abcfdb73e5bbb19e213fd76532ee2be5 # v3.0.0
158172
with:
159173
name: ${{env.TAG_NAME}}
160174
tag_name: ${{env.TAG_NAME}}
161175
generate_release_notes: true
162176
prerelease: ${{ inputs.dev }}
163177

164-
notify:
165-
if: inputs.dev == false
166-
needs: release
167-
uses: Checkmarx/plugins-release-workflow/.github/workflows/release-notify.yml@main
168-
with:
169-
product_name: Javascript Runtime Wrapper
170-
release_version: ${{ needs.release.outputs.TAG_NAME }}
171-
cli_release_version: ${{ needs.release.outputs.CLI_VERSION }}
172-
release_author: "Sypher Team"
173-
release_url: https://github.com/Checkmarx/ast-cli-javascript-wrapper-runtime-cli/releases/tag/${{ needs.release.outputs.TAG_NAME }}
174-
jira_product_name: JS_RUNTIME_WRAPPER
175-
secrets: inherit
178+
# notify:
179+
# if: inputs.dev == false
180+
# needs: release
181+
# uses: Checkmarx/plugins-release-workflow/.github/workflows/release-notify.yml@main
182+
# with:
183+
# product_name: Javascript Runtime Wrapper
184+
# release_version: ${{ needs.release.outputs.TAG_NAME }}
185+
# cli_release_version: ${{ needs.release.outputs.CLI_VERSION }}
186+
# release_author: "Sypher Team"
187+
# release_url: https://github.com/Checkmarx/ast-cli-javascript-wrapper-runtime-cli/releases/tag/${{ needs.release.outputs.TAG_NAME }}
188+
# jira_product_name: JS_RUNTIME_WRAPPER
189+
# secrets: inherit
176190

177-
dispatch_auto_release:
178-
name: Update ADO Extension With new Wrapper Version
179-
if: inputs.dev == false
180-
needs: notify
181-
uses: Checkmarx/plugins-release-workflow/.github/workflows/dispatch-workflow.yml@main
182-
with:
183-
cli_version: ${{ needs.release.outputs.CLI_VERSION }}
184-
is_cli_release: false
185-
is_js_runtime_release: true
186-
secrets: inherit
191+
# dispatch_auto_release:
192+
# name: Update ADO Extension With new Wrapper Version
193+
# if: inputs.dev == false
194+
# needs: notify
195+
# uses: Checkmarx/plugins-release-workflow/.github/workflows/dispatch-workflow.yml@main
196+
# with:
197+
# cli_version: ${{ needs.release.outputs.CLI_VERSION }}
198+
# is_cli_release: false
199+
# is_js_runtime_release: true
200+
# secrets: inherit

.github/workflows/update-cli.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
- name: Create Pull Request
9696
id: cretae_pull_request
9797
if: steps.checkmarx-ast-cli.outputs.current_tag != steps.checkmarx-ast-cli.outputs.release_tag
98-
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c #v6
98+
uses: step-security/create-pull-request@50c103da2b9ca12cd5bc013fc6931051a5aa872b # v8.1.1
9999
with:
100100
token: ${{ secrets.AUTOMATION_TOKEN }}
101101
commit-message: Update checkmarx-ast-cli to ${{ steps.checkmarx-ast-cli.outputs.release_tag }}

0 commit comments

Comments
 (0)