Skip to content

Commit 296789d

Browse files
[ACS-10124] Fix Change this action to not use user-controlled data directly in a run block sonar issue (#4810)
* [ACS-10124] Fix Change this action to not use user-controlled data directly in a run block sonar issue * [ACS-10124] Corrected typo
1 parent 0407c23 commit 296789d

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
lines changed

.github/actions/get-image-tag/action.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ runs:
1111
steps:
1212
- name: Get docker image tag name
1313
shell: bash
14+
env:
15+
BRANCH_NAME: ${{ inputs.branch_name }}
16+
RUN_ID: ${{ github.run_id }}
1417
run: |
15-
if [[ "${{ inputs.branch_name }}" == "master" ]] || [[ "${{ inputs.branch_name }}" == release/* ]]; then
18+
if [[ "$BRANCH_NAME" == "master" ]] || [[ "$BRANCH_NAME" == release/* ]]; then
1619
TAG_VERSION="$(jq -cr '.version' < package.json)"
1720
else
18-
TAG_VERSION="${{ inputs.branch_name }}-${{ github.run_id }}"
21+
TAG_VERSION="${BRANCH_NAME}-${RUN_ID}"
1922
fi
2023
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV

.github/actions/git-tag/action.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ runs:
1717
steps:
1818
- name: publish tag
1919
shell: bash
20+
env:
21+
BRANCH_NAME: ${{ inputs.branch_name }}
22+
GITHUB_TOKEN: ${{ inputs.github_token }}
2023
run: |
21-
if [[ "${{ inputs.branch_name }}" == "master" ]] || [[ "${{ inputs.branch_name }}" == release/* ]]; then
24+
if [[ "$BRANCH_NAME" == "master" ]] || [[ "$BRANCH_NAME" == release/* ]]; then
2225
VERSION=$(jq -cr '.version' < package.json)
2326
echo "git tag -a ${VERSION} -m ${VERSION}"
2427
@@ -28,7 +31,7 @@ runs:
2831
if [[ "${{ inputs.dry-run }}" != "true" ]]; then
2932
git tag -a ${VERSION} -m "${VERSION} [ci skip] "
3033
git remote rm origin
31-
GITHUB_REPO=https://${{ inputs.github_token }}:x-oauth-basic@github.com/Alfresco/alfresco-content-app.git
34+
GITHUB_REPO=https://$GITHUB_TOKEN:x-oauth-basic@github.com/Alfresco/alfresco-content-app.git
3235
git remote add origin $GITHUB_REPO
3336
git push origin --tags
3437
fi

.github/actions/run-e2e-playwright/action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ runs:
1919

2020
- name: Setup and run with options
2121
shell: bash
22+
env:
23+
OPTIONS: ${{ inputs.options }}
2224
run: |
2325
npm start > /dev/null &\
2426
@@ -29,5 +31,5 @@ runs:
2931
done
3032
printf "\nApplication is ready.\n"
3133
32-
echo "Running playwright tests with options ${{ inputs.options }}"
33-
E2E_TARGET=${{ inputs.options }} npm run ci:e2e
34+
echo "Running playwright tests with options $OPTIONS"
35+
E2E_TARGET=$OPTIONS npm run ci:e2e

.github/actions/setup/action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ runs:
2222
- uses: Alfresco/alfresco-build-tools/.github/actions/get-branch-name@v8.33.0
2323
- name: set TAG_NPM
2424
shell: bash
25+
env:
26+
NPM_TAG: ${{ inputs.npm_tag }}
2527
run: |
26-
if [[ -n "${{ inputs.npm_tag }}" ]]; then
27-
TAG_NPM=${{ inputs.npm_tag }}
28+
if [[ -n "$NPM_TAG" ]]; then
29+
TAG_NPM=$NPM_TAG
2830
else
2931
TAG_NPM="alpha"
3032
VERSION_IN_PACKAGE_JSON=$(jq -cr '.version' < package.json)

.github/actions/update-library-versions/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ runs:
1414
steps:
1515
- name: Update Versions
1616
shell: bash
17+
env:
18+
BRANCH_NAME: ${{ inputs.branch_name }}
1719
run: |
1820
VERSION_IN_PACKAGE_JSON=$(jq -cr '.version' < package.json)
1921
20-
if [[ ${{ inputs.branch_name }} =~ ^master.*?$ ]] || [[ "${{ inputs.branch_name }}" == release/* ]] ; then
22+
if [[ $BRANCH_NAME =~ ^master.*?$ ]] || [[ "$BRANCH_NAME" == release/* ]] ; then
2123
NEW_LIBRARY_VERSION="$VERSION_IN_PACKAGE_JSON"
2224
else
2325
NEW_LIBRARY_VERSION="${VERSION_IN_PACKAGE_JSON}-${{ github.run_id }}"

0 commit comments

Comments
 (0)