Skip to content

Commit a728f44

Browse files
Harden workflows: scope permissions, fix set-output, replace dev-drprasad, remove repository_dispatch, comment notify and spotbugs
1 parent 4932c20 commit a728f44

4 files changed

Lines changed: 48 additions & 40 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ jobs:
8282
- name: Build with Maven
8383
run: mvn -B verify -DskipTests -Dgpg.skip --file pom.xml
8484

85-
- name: Run SpotBugs Analysis
86-
if: ${{ github.actor != 'dependabot[bot]' }}
87-
uses: jwgmeligmeyling/spotbugs-github-action@b8e2c3523acb34c87f14e18cbcd2d87db8c8584e #v1.2
88-
with:
89-
path: '**/spotbugsXml.xml'
85+
# - name: Run SpotBugs Analysis
86+
# if: ${{ github.actor != 'dependabot[bot]' }}
87+
# uses: jwgmeligmeyling/spotbugs-github-action@b8e2c3523acb34c87f14e18cbcd2d87db8c8584e #v1.2
88+
# with:
89+
# path: '**/spotbugsXml.xml'

.github/workflows/nightly.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,24 @@ on:
55
branches:
66
- main
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
delete_tag:
13+
permissions:
14+
contents: write
1015
runs-on: cx-public-ubuntu-x64
1116
steps:
12-
- name: Delete release
13-
uses: dev-drprasad/delete-tag-and-release@8cd619d00037e4aeb781909c9a6b03940507d0da # v1.0.1
17+
- name: Delete release and tag
1418
env:
15-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16-
with:
17-
delete_release: true
18-
tag_name: 1.0.0-SNAPSHOT
19+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
run: |
21+
gh release delete "1.0.0-SNAPSHOT" --yes --cleanup-tag --repo ${{ github.repository }} || true
22+
1923
nightly:
2024
needs: delete_tag
21-
uses: CheckmarxDev/ast-cli-java-wrapper/.github/workflows/release.yml@main
25+
uses: Checkmarx/ast-cli-java-wrapper/.github/workflows/release.yml@main
2226
with:
2327
tag: "1.0.0-SNAPSHOT"
2428
dev: true

.github/workflows/release.yml

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ on:
3232
required: false
3333
type: string
3434

35+
permissions:
36+
contents: read
37+
3538
jobs:
3639
release:
40+
permissions:
41+
id-token: write
42+
contents: write
3743
runs-on: cx-public-ubuntu-x64
3844
outputs:
3945
CLI_VERSION: ${{ steps.extract_cli_version.outputs.CLI_VERSION }}
@@ -57,7 +63,7 @@ jobs:
5763
CLI_VERSION=$(./src/main/resources/cx-linux version | grep -Eo '^[0-9]+\.[0-9]+\.[0-9]+')
5864
echo "CLI version being packed is $CLI_VERSION"
5965
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
60-
echo "::set-output name=CLI_VERSION::$CLI_VERSION"
66+
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_OUTPUT
6167
6268
- name: Check if CLI version is latest
6369
if: ${{ github.event.inputs.dev == 'false' && !github.event.inputs.cliTag && github.ref == 'refs/heads/main' }}
@@ -85,7 +91,7 @@ jobs:
8591
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
8692
git tag -a "${tag}" -m "${message}"
8793
git push origin "${tag}"
88-
echo "::set-output name=TAG_NAME::${{ inputs.tag }}"
94+
echo "TAG_NAME=${{ inputs.tag }}" >> $GITHUB_OUTPUT
8995
9096
- name: Cache local Maven repository
9197
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
@@ -131,26 +137,26 @@ jobs:
131137
tag_name: ${{ inputs.tag }}
132138
prerelease: ${{ inputs.dev }}
133139

134-
notify:
135-
if: inputs.dev == false
136-
needs: release
137-
uses: Checkmarx/plugins-release-workflow/.github/workflows/release-notify.yml@main
138-
with:
139-
product_name: Java Wrapper
140-
release_version: ${{ needs.release.outputs.TAG_NAME }}
141-
cli_release_version: ${{ needs.release.outputs.CLI_VERSION }}
142-
release_author: "Sypher Team"
143-
release_url: https://github.com/Checkmarx/ast-cli-java-wrapper/releases/tag/${{ needs.release.outputs.TAG_NAME }}
144-
jira_product_name: JAVA_WRAPPER
145-
secrets: inherit
140+
# notify:
141+
# if: inputs.dev == false
142+
# needs: release
143+
# uses: Checkmarx/plugins-release-workflow/.github/workflows/release-notify.yml@main
144+
# with:
145+
# product_name: Java Wrapper
146+
# release_version: ${{ needs.release.outputs.TAG_NAME }}
147+
# cli_release_version: ${{ needs.release.outputs.CLI_VERSION }}
148+
# release_author: "Sypher Team"
149+
# release_url: https://github.com/Checkmarx/ast-cli-java-wrapper/releases/tag/${{ needs.release.outputs.TAG_NAME }}
150+
# jira_product_name: JAVA_WRAPPER
151+
# secrets: inherit
146152

147-
dispatch_auto_release:
148-
name: Update Jenkins/Jetbrains/Eclipse Extensions With new Wrapper Version
149-
if: inputs.dev == false
150-
needs: notify
151-
uses: Checkmarx/plugins-release-workflow/.github/workflows/dispatch-workflow.yml@main
152-
with:
153-
cli_version: ${{ needs.release.outputs.CLI_VERSION }}
154-
is_cli_release: false
155-
is_java_release: true
156-
secrets: inherit
153+
# dispatch_auto_release:
154+
# name: Update Jenkins/Jetbrains/Eclipse Extensions With new Wrapper Version
155+
# if: inputs.dev == false
156+
# needs: notify
157+
# uses: Checkmarx/plugins-release-workflow/.github/workflows/dispatch-workflow.yml@main
158+
# with:
159+
# cli_version: ${{ needs.release.outputs.CLI_VERSION }}
160+
# is_cli_release: false
161+
# is_java_release: true
162+
# secrets: inherit

.github/workflows/update-cli.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Update checkmarx ast cli
22

33
on:
44
workflow_dispatch:
5-
repository_dispatch:
6-
types: [cli-version-update]
75

86
permissions:
97
contents: read
@@ -31,8 +29,8 @@ jobs:
3129
- name: Get Latest Checkmarx API version
3230
id: checkmarx-ast-cli
3331
run: |
34-
echo ::set-output name=release_tag::$(curl -sL https://api.github.com/repos/checkmarx/ast-cli/releases/latest | jq -r ".tag_name")
35-
echo ::set-output name=current_tag::$(<checkmarx-ast-cli.version)
32+
echo "release_tag=$(curl -sL https://api.github.com/repos/checkmarx/ast-cli/releases/latest | jq -r '.tag_name')" >> $GITHUB_OUTPUT
33+
echo "current_tag=$(<checkmarx-ast-cli.version)" >> $GITHUB_OUTPUT
3634
3735
- name: Update Checkmarx cli version
3836
if: steps.checkmarx-ast-cli.outputs.current_tag != steps.checkmarx-ast-cli.outputs.release_tag

0 commit comments

Comments
 (0)