Skip to content
Merged
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
22 changes: 13 additions & 9 deletions .github/workflows/bump-gitstream-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ jobs:
node-version-file: .nvmrc

- name: Set version to ENV
env:
INPUT_VERSION: ${{ inputs.version }}
run: |
echo "VERSION=${{ inputs.version }}" >> "$GITHUB_ENV"
echo "BRANCH_NAME=bump-gitstream-core-to-${{ inputs.version }}" >> "$GITHUB_ENV"
echo "VERSION=$INPUT_VERSION" >> "$GITHUB_ENV"
echo "BRANCH_NAME=bump-gitstream-core-to-$INPUT_VERSION" >> "$GITHUB_ENV"
Comment on lines +47 to +48

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ”’ Security - GITHUB_ENV injection via input: Validate INPUT_VERSION against a strict semver regex and fail before writing to $GITHUB_ENV. Alternatively, skip $GITHUB_ENV for these values and pass them via step-level env: from inputs.version.

Suggested change
echo "VERSION=$INPUT_VERSION" >> "$GITHUB_ENV"
echo "BRANCH_NAME=bump-gitstream-core-to-$INPUT_VERSION" >> "$GITHUB_ENV"
if [[ ! "$INPUT_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then
echo "::error::Invalid version: must be a valid semver string"
exit 1
fi
echo "VERSION=$INPUT_VERSION" >> "$GITHUB_ENV"
echo "BRANCH_NAME=bump-gitstream-core-to-$INPUT_VERSION" >> "$GITHUB_ENV"
Is this review accurate? Use πŸ‘ or πŸ‘Ž to rate it

If you want to tell us more, use /gs feedback e.g. /gs feedback this review doesn't make sense, I disagree, and it keeps repeating over and over

echo "LABEL_ARG=" >> "$GITHUB_ENV"
echo "REVIEWER_ARG=" >> "$GITHUB_ENV"

Expand All @@ -53,16 +55,17 @@ jobs:
echo "LABEL_ARG=--label auto-deploy" >> "$GITHUB_ENV"

- name: Set reviewer
env:
REVIEWER: ${{ inputs.reviewer || github.actor }}
run: |
REVIEWER="${{ inputs.reviewer || github.actor }}"
echo "REVIEWER_ARG=--reviewer $REVIEWER" >> "$GITHUB_ENV"

- name: Init npmrc
run: |
curl -H "X-JFrog-Art-API: ${{ secrets.ARTIFACTORY_API_KEY }}" https://linearb.jfrog.io/linearb/api/npm/npm-local/auth/linearb >> .npmrc

- name: Install @linearb/gitstream-core@${{ env.VERSION }}
run: npm install --save --save-exact @linearb/gitstream-core@${{ env.VERSION }}
run: npm install --save --save-exact "@linearb/gitstream-core@$VERSION"

- name: Run Format & Lint & Test & Build & Package
run: npm run all
Expand All @@ -71,18 +74,19 @@ jobs:
id: create-pr
env:
GH_TOKEN: ${{ secrets.CI_USER_GIT_TOKEN }}
PR_DESCRIPTION: ${{ inputs.description }}
run: |
echo -e "${{ inputs.description }}" > pr_description.txt
echo -e "$PR_DESCRIPTION" > pr_description.txt
git config --global user.name 'GitHub Actions Bot'
git config --global user.email 'actions@github.com'
git add package.json package-lock.json dist/index.js
git commit -m "bump @linearb/gitstream-core to ${{ env.VERSION }}"
git push origin HEAD:${{ env.BRANCH_NAME }}
git commit -m "bump @linearb/gitstream-core to $VERSION"
git push origin "HEAD:$BRANCH_NAME"
PR_URL=$(gh pr create \
--base develop \
--title 'Bump `@linearb/gitstream-core` to `${{ env.VERSION }}`' \
--title "Bump \`@linearb/gitstream-core\` to \`$VERSION\`" \
--body-file pr_description.txt \
--head ${{ env.BRANCH_NAME }} ${{ env.REVIEWER_ARG }} ${{ env.LABEL_ARG }})
--head "$BRANCH_NAME" $REVIEWER_ARG $LABEL_ARG)
echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT

- name: Output PR URL
Expand Down