Skip to content

chore(deps): Bump github/codeql-action from 3.25.5 to 3.25.11 #185

chore(deps): Bump github/codeql-action from 3.25.5 to 3.25.11

chore(deps): Bump github/codeql-action from 3.25.5 to 3.25.11 #185

# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: tests
on:
push:
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [main]
workflow_dispatch:
permissions:
contents: read # Needed to check out the repo.
jobs:
# Unit tests for TypeScript code
######################################
ts-tests:
name: TypeScript unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
- name: unit tests
run: |
make unit-test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@6d798873df2b1b8e5846dba6fb86631229fbcb17 # v4.4.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: "coverage/cobertura-coverage.xml"
fail_ci_if_error: true
# check-dist for actions
###############################
check-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
- name: Rebuild the dist/ directory
run: make clean package
- name: Compare the expected and actual dist/ directories
id: diff
run: |
set -euo pipefail
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "::error::Detected uncommitted changes after build. See status below:"
echo "::group::git diff"
GIT_PAGER="cat" git diff
echo "::endgroup::"
exit 1
fi
# If dist/ was different from expected, upload the expected version as an artifact
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/
# autogen for license headers
###############################
autogen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: mbrukman/autogen
ref: 9026b78e17573b5dda4bff79033c352443551dc5
path: autogen
- run: |
echo "${GITHUB_WORKSPACE}/autogen" >> "${GITHUB_PATH}"
- run: make autogen
- name: check diff
run: |
set -euo pipefail
if [ "$(GIT_PAGER="cat" git diff --ignore-space-at-eol | wc -l)" -gt "0" ]; then
echo "::error::Detected license header changes. See status below:"
echo "::group::git diff"
GIT_PAGER="cat" git diff
echo "::endgroup::"
exit 1
fi
# linters
###############################
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: actionlint
env:
SHELLCHECK_VERSION: "0.9.0"
SHELLCHECK_CHECKSUM: "700324c6dd0ebea0117591c6cc9d7350d9c7c5c287acbad7630fa17b1d4d9e2f"
ACTIONLINT_VERSION: "1.6.26"
ACTIONLINT_CHECKSUM: "f0294c342af98fad4ff917bc32032f28e1b55f76aedf291886ec10bbed7c12e1"
run: |
set -euo pipefail
# Install shellcheck
curl -sSLo shellcheck.tar.gz "https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz"
if ! echo "${SHELLCHECK_CHECKSUM} shellcheck.tar.gz" | sha256sum --strict --check --status; then
echo "::error::Unexpected checksum for shellcheck: expected '${SHELLCHECK_CHECKSUM}', got '$(sha256sum shellcheck.tar.gz | awk '{ print $1 }')'"
exit 1
fi
tar xf shellcheck.tar.gz
mv "shellcheck-v${SHELLCHECK_VERSION}/shellcheck" /usr/local/bin
# Install actionlint
curl -sSLo actionlint.tar.gz "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz"
if ! echo "${ACTIONLINT_CHECKSUM} actionlint.tar.gz" | sha256sum --strict --check --status; then
echo "::error::Unexpected checksum for actionlint: expected '${ACTIONLINT_CHECKSUM}', got '$(sha256sum actionlint.tar.gz | awk '{ print $1 }')'"
exit 1
fi
tar xf actionlint.tar.gz
mv ./actionlint /usr/local/bin
make actionlint
markdownlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
- run: make markdownlint
yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- env:
YAMLLINT_VERSION: "1.26.3"
run: |
set -euo pipefail
# Install yamllint
pip install -r requirements.txt --require-hashes
# Run yamllint
make yamllint
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
- run: make eslint
# e2e tests.
###############################
issue-reopener-basic:
runs-on: ubuntu-latest
outputs:
issue-url: ${{ steps.create-issue.outputs.url }}
permissions:
issues: write
steps:
- name: Checkout action
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: "todo-issue-reopener"
# NOTE: We want to call the todo-issue-reopener action from a checkout on
# the default path of GITHUB_WORKSPACE but we don't want the code
# from the action itself to affect the outcome. We move it to /tmp
# so that it outside of the GITHUB_WORKSPACE.
- name: Move checkout to tmp
run: |
mv "${GITHUB_WORKSPACE}/todo-issue-reopener" "/tmp"
- id: create-issue
name: Create closed issue
env:
GH_TOKEN: ${{ github.token }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
body=""
if [ "${PR_URL}" != "" ]; then
body="Test issue for commit $PR ${PR_URL}"
else
body="Test issue for commit ${GITHUB_SHA}"
fi
body="${body}
- [Workflow run](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/attempts/${GITHUB_RUN_ATTEMPT})"
url=$(gh issue create -R "${GITHUB_REPOSITORY}" --title "issue-reopener-basic pre-submit test issue" --body "${body}" --label "test-issue")
echo "::debug::Closing GitHub issue: ${url}"
gh issue close "${url}"
echo "url=${url}" >> "${GITHUB_OUTPUT}"
- name: Setup mock repo
env:
ISSUE_URL: ${{ steps.create-issue.outputs.url }}
run: |
git init
mkdir test
echo "// TODO(${ISSUE_URL}): still open" > test/test.go
# NOTE: We cannot use dynamic variables or absolute paths.
# Here we must provide a path relative to GITHUB_WORKSPACE so we ensure
# we get back to the root tmp directory no matter what GITHUB_WORKSPACE
# directory is set to.
- name: Run todo-issue-reopener
uses: "./../../../../../../../../../../../tmp/todo-issue-reopener"
- name: Check issue was reopened
env:
GH_TOKEN: ${{ github.token }}
ISSUE_URL: ${{ steps.create-issue.outputs.url }}
run: |
# Ensure the issue was reopened.
state=$(gh issue view "${ISSUE_URL}" --json state | jq -r '.state')
[ "${state}" == "OPEN" ]
# Check that the body contains the right path
# NOTE: Need to get text output in order to get issue comments.
body=$(gh issue view "${ISSUE_URL}" -c)
[[ "${body}" == *"1. [test/test.go:1]"* ]]
issue-reopener-basic-cleanup:
runs-on: ubuntu-latest
needs: issue-reopener-basic
if: ${{ always() }}
permissions:
issues: write
steps:
- env:
ISSUE_URL: ${{ needs.issue-reopener-basic.outputs.issue-url }}
GH_TOKEN: ${{ github.token }}
run: |
# Close the test issue.
gh issue close "${ISSUE_URL}" || true
issue-reopener-path:
runs-on: ubuntu-latest
outputs:
issue-url: ${{ steps.create-issue.outputs.url }}
permissions:
issues: write
steps:
- name: Checkout action
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: "todo-issue-reopener"
- id: create-issue
name: Create closed issue
env:
GH_TOKEN: ${{ github.token }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
body=""
if [ "${PR_URL}" != "" ]; then
body="Test issue for commit $PR ${PR_URL}"
else
body="Test issue for commit ${GITHUB_SHA}"
fi
body="${body}
- [Workflow run](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/attempts/${GITHUB_RUN_ATTEMPT})"
url=$(gh issue create -R "${GITHUB_REPOSITORY}" --title "issue-reopener-path pre-submit test issue" --body "${body}" --label "test-issue")
echo "::debug::Closing GitHub issue: ${url}"
gh issue close "${url}"
echo "url=${url}" >> "${GITHUB_OUTPUT}"
- name: Setup mock repo
env:
ISSUE_URL: ${{ steps.create-issue.outputs.url }}
run: |
git init
mkdir test
echo "// TODO(${ISSUE_URL}): still open" > test/test.go
- uses: ./todo-issue-reopener/
with:
path: "test/"
- env:
GH_TOKEN: ${{ github.token }}
ISSUE_URL: ${{ steps.create-issue.outputs.url }}
run: |
# Ensure the issue was reopened.
state=$(gh issue view "${ISSUE_URL}" --json state | jq -r '.state')
[ "${state}" == "OPEN" ]
# Check that the body contains the right path
# NOTE: Need to get text output in order to get issue comments.
body=$(gh issue view "${ISSUE_URL}" -c)
[[ "${body}" == *"1. [test/test.go:1]"* ]]
issue-reopener-path-cleanup:
runs-on: ubuntu-latest
needs: issue-reopener-path
if: ${{ always() }}
permissions:
issues: write
steps:
- env:
ISSUE_URL: ${{ needs.issue-reopener-path.outputs.issue-url }}
GH_TOKEN: ${{ github.token }}
run: |
# Close the test issue.
gh issue close "${ISSUE_URL}" || true
issue-reopener-dry-run:
runs-on: ubuntu-latest
outputs:
issue-url: ${{ steps.create-issue.outputs.url }}
permissions:
issues: write
steps:
- name: Checkout action
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: "todo-issue-reopener"
# NOTE: We want to call the todo-issue-reopener action from a checkout on
# the default path of GITHUB_WORKSPACE but we don't want the code
# from the action itself to affect the outcome. We move it to /tmp
# so that it outside of the GITHUB_WORKSPACE.
- name: Move checkout to tmp
run: |
mv "${GITHUB_WORKSPACE}/todo-issue-reopener" "/tmp"
- id: create-issue
name: Create closed issue
env:
GH_TOKEN: ${{ github.token }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
body=""
if [ "${PR_URL}" != "" ]; then
body="Test issue for commit $PR ${PR_URL}"
else
body="Test issue for commit ${GITHUB_SHA}"
fi
body="${body}
- [Workflow run](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/attempts/${GITHUB_RUN_ATTEMPT})"
url=$(gh issue create -R "${GITHUB_REPOSITORY}" --title "issue-reopener-dry-run pre-submit test issue" --body "${body}" --label "test-issue")
echo "::debug::Closing GitHub issue: ${url}"
gh issue close "${url}"
echo "url=${url}" >> "${GITHUB_OUTPUT}"
- name: Setup mock repo
env:
ISSUE_URL: ${{ steps.create-issue.outputs.url }}
run: |
git init
mkdir test
echo "// TODO(${ISSUE_URL}): still open" > test/test.go
# NOTE: We cannot use dynamic variables or absolute paths.
# Here we must provide a path relative to GITHUB_WORKSPACE so we ensure
# we get back to the root tmp directory no matter what GITHUB_WORKSPACE
# directory is set to.
- name: Run todo-issue-reopener
uses: "./../../../../../../../../../../../tmp/todo-issue-reopener"
with:
dry-run: true
- name: Check issue is still closed.
env:
GH_TOKEN: ${{ github.token }}
ISSUE_URL: ${{ steps.create-issue.outputs.url }}
run: |
# Ensure the issue was not reopened.
state=$(gh issue view "${ISSUE_URL}" --json state | jq -r '.state')
[ "${state}" == "CLOSED" ]
issue-reopener-dry-run-cleanup:
runs-on: ubuntu-latest
needs: issue-reopener-dry-run
if: ${{ always() }}
permissions:
issues: write
steps:
- env:
ISSUE_URL: ${{ needs.issue-reopener-dry-run.outputs.issue-url }}
GH_TOKEN: ${{ github.token }}
run: |
# Ensure the the test issue is closed even if test fails.
gh issue close "${ISSUE_URL}" || true
issue-reopener-subdir:
runs-on: ubuntu-latest
outputs:
issue-url: ${{ steps.create-issue.outputs.url }}
permissions:
issues: write
steps:
- name: Checkout action
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: "todo-issue-reopener"
- id: create-issue
name: Create closed issue
env:
GH_TOKEN: ${{ github.token }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
body=""
if [ "${PR_URL}" != "" ]; then
body="Test issue for commit $PR ${PR_URL}"
else
body="Test issue for commit ${GITHUB_SHA}"
fi
body="${body}
- [Workflow run](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/attempts/${GITHUB_RUN_ATTEMPT})"
url=$(gh issue create -R "${GITHUB_REPOSITORY}" --title "issue-reopener-subdir pre-submit test issue" --body "${body}" --label "test-issue")
echo "::debug::Closing GitHub issue: ${url}"
gh issue close "${url}"
echo "url=${url}" >> "${GITHUB_OUTPUT}"
- name: Setup mock repo
env:
ISSUE_URL: ${{ steps.create-issue.outputs.url }}
run: |
mkdir -p test/subdir
cd test/
git init
echo "// TODO(${ISSUE_URL}): still open" > subdir/test.go
- name: Run todo-issue-reopener
uses: "./todo-issue-reopener"
with:
path: "test/subdir/"
- env:
GH_TOKEN: ${{ github.token }}
ISSUE_URL: ${{ steps.create-issue.outputs.url }}
run: |
# Ensure the issue was reopened.
state=$(gh issue view "${ISSUE_URL}" --json state | jq -r '.state')
[ "${state}" == "OPEN" ]
# Check that the body contains the right path
# NOTE: Need to get text output in order to get issue comments.
body=$(gh issue view "${ISSUE_URL}" -c)
[[ "${body}" == *"1. [subdir/test.go:1]"* ]]
issue-reopener-subdir-cleanup:
runs-on: ubuntu-latest
needs: issue-reopener-subdir
if: ${{ always() }}
permissions:
issues: write
steps:
- env:
ISSUE_URL: ${{ needs.issue-reopener-subdir.outputs.issue-url }}
GH_TOKEN: ${{ github.token }}
run: |
# Close the test issue.
gh issue close "${ISSUE_URL}" || true
issue-reopener-vanityURLs:
runs-on: ubuntu-latest
outputs:
issue-url: ${{ steps.create-issue.outputs.url }}
permissions:
issues: write
steps:
- name: Checkout action
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: "todo-issue-reopener"
# NOTE: We want to call the todo-issue-reopener action from a checkout on
# the default path of GITHUB_WORKSPACE but we don't want the code
# from the action itself to affect the outcome. We move it to /tmp
# so that it outside of the GITHUB_WORKSPACE.
- name: Move checkout to tmp
run: |
mv "${GITHUB_WORKSPACE}/todo-issue-reopener" "/tmp"
- id: create-issue
name: Create closed issue
env:
GH_TOKEN: ${{ github.token }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
body=""
if [ "${PR_URL}" != "" ]; then
body="Test issue for commit $PR ${PR_URL}"
else
body="Test issue for commit ${GITHUB_SHA}"
fi
body="${body}
- [Workflow run](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/attempts/${GITHUB_RUN_ATTEMPT})"
url=$(gh issue create -R "${GITHUB_REPOSITORY}" --title "issue-reopener-vanityURLs pre-submit test issue" --body "${body}" --label "test-issue")
echo "::debug::Closing GitHub issue: ${url}"
gh issue close "${url}"
echo "url=${url}" >> "${GITHUB_OUTPUT}"
- name: Setup mock repo
env:
ISSUE_URL: ${{ steps.create-issue.outputs.url }}
run: |
git init
mkdir test
issue_no="${ISSUE_URL##*/}"
vanity_url="https://golang.org/issues/${issue_no}"
echo "::debug::Vanity issue url: ${url}"
echo "// TODO(${vanity_url}): still open" > test/test.go
mkdir .github
echo "vanityURLs:" >> .github/issue-reopener.yml
echo "- \"^\\\\s*(https?://)?golang.org/issues/(?<id>[0-9]+)\\\\s*$\"" >> .github/issue-reopener.yml
# NOTE: We cannot use dynamic variables or absolute paths.
# Here we must provide a path relative to GITHUB_WORKSPACE so we ensure
# we get back to the root tmp directory no matter what GITHUB_WORKSPACE
# directory is set to.
- name: Run todo-issue-reopener
uses: "./../../../../../../../../../../../tmp/todo-issue-reopener"
- env:
GH_TOKEN: ${{ github.token }}
ISSUE_URL: ${{ steps.create-issue.outputs.url }}
run: |
# Ensure the issue was reopened.
state=$(gh issue view "${ISSUE_URL}" --json state | jq -r '.state')
[ "${state}" == "OPEN" ]
# Check that the body contains the right path
# NOTE: Need to get text output in order to get issue comments.
body=$(gh issue view "${ISSUE_URL}" -c)
[[ "${body}" == *"1. [test/test.go:1]"* ]]
issue-reopener-vanityURLs-cleanup:
runs-on: ubuntu-latest
needs: issue-reopener-vanityURLs
if: ${{ always() }}
permissions:
issues: write
steps:
- env:
ISSUE_URL: ${{ needs.issue-reopener-vanityURLs.outputs.issue-url }}
GH_TOKEN: ${{ github.token }}
run: |
# Close the test issue.
gh issue close "${ISSUE_URL}" || true