Harden workflows and dev scripts against code-scanning findings
- auto-release: pass step outputs to run scripts through env, not ${{ }} interpolation
- perf-comment: download the PR's perf artifact to RUNNER_TEMP, outside the workspace
- dev server: log errors to the terminal instead of sending stack traces in the response
- i18n-add/i18n-check: escape every regex metacharacter when building patterns from labels
This commit is contained in:
parent
1a6c63e920
commit
e7729d0a1e
5 changed files with 21 additions and 8 deletions
18
.github/workflows/auto-release.yml
vendored
18
.github/workflows/auto-release.yml
vendored
|
|
@ -63,20 +63,28 @@ jobs:
|
|||
|
||||
- name: Publish the release
|
||||
if: steps.v.outputs.skip == 'false'
|
||||
env:
|
||||
TAG: ${{ steps.v.outputs.tag }}
|
||||
VER: ${{ steps.v.outputs.ver }}
|
||||
PRE: ${{ steps.v.outputs.pre }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
pre=(); [ "${{ steps.v.outputs.pre }}" = "true" ] && pre=(--prerelease)
|
||||
gh release create "${{ steps.v.outputs.tag }}" --repo "$GITHUB_REPOSITORY" \
|
||||
--target "$GITHUB_SHA" --title "${{ steps.v.outputs.ver }}" --notes-file notes.md "${pre[@]}"
|
||||
pre=(); [ "$PRE" = "true" ] && pre=(--prerelease)
|
||||
gh release create "$TAG" --repo "$GITHUB_REPOSITORY" \
|
||||
--target "$GITHUB_SHA" --title "$VER" --notes-file notes.md "${pre[@]}"
|
||||
|
||||
- name: Deploy it
|
||||
# Pre-releases are for testing and never go live.
|
||||
if: steps.v.outputs.skip == 'false' && steps.v.outputs.pre == 'false'
|
||||
run: gh workflow run release.yml --repo "$GITHUB_REPOSITORY" --ref "${{ steps.v.outputs.tag }}" -f tag="${{ steps.v.outputs.tag }}"
|
||||
env:
|
||||
TAG: ${{ steps.v.outputs.tag }}
|
||||
run: gh workflow run release.yml --repo "$GITHUB_REPOSITORY" --ref "$TAG" -f tag="$TAG"
|
||||
|
||||
- name: Publish the Docker image
|
||||
# Same pattern as the deploy above: the image is built and pushed from the
|
||||
# release tag by docker.yml. Pre-releases get one too: an image tag is
|
||||
# pulled on purpose, so a test image costs nothing.
|
||||
if: steps.v.outputs.skip == 'false'
|
||||
run: gh workflow run docker.yml --repo "$GITHUB_REPOSITORY" --ref "${{ steps.v.outputs.tag }}" -f tag="${{ steps.v.outputs.tag }}"
|
||||
env:
|
||||
TAG: ${{ steps.v.outputs.tag }}
|
||||
run: gh workflow run docker.yml --repo "$GITHUB_REPOSITORY" --ref "$TAG" -f tag="$TAG"
|
||||
|
|
|
|||
3
.github/workflows/perf-comment.yml
vendored
3
.github/workflows/perf-comment.yml
vendored
|
|
@ -20,6 +20,8 @@ jobs:
|
|||
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: perf
|
||||
# Outside the workspace: the files come from a PR's run and are only ever read as text.
|
||||
path: ${{ runner.temp }}/perf
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Post or update the comment
|
||||
|
|
@ -28,6 +30,7 @@ jobs:
|
|||
REPO: ${{ github.repository }}
|
||||
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/perf"
|
||||
pr=$(tr -cd '0-9' < pr-number.txt)
|
||||
[ -n "$pr" ] || { echo "no PR number"; exit 0; }
|
||||
# Trust the number only if that PR's head is the commit that was benchmarked.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue