mirror of
https://github.com/github/codeql-action.git
synced 2025-12-09 17:28:06 +08:00
Compare commits
1 Commits
v2.24.6
...
nickfyson/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d1ef4509b |
5
.github/update-release-branch.py
vendored
5
.github/update-release-branch.py
vendored
@@ -255,10 +255,13 @@ def main():
|
|||||||
print(f'No commits to merge from {source_branch} to {target_branch}.')
|
print(f'No commits to merge from {source_branch} to {target_branch}.')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# define distinct prefix in order to support specific pr checks on backports
|
||||||
|
branch_prefix = 'update' if is_primary_release else 'backport'
|
||||||
|
|
||||||
# The branch name is based off of the name of branch being merged into
|
# The branch name is based off of the name of branch being merged into
|
||||||
# and the SHA of the branch being merged from. Thus if the branch already
|
# and the SHA of the branch being merged from. Thus if the branch already
|
||||||
# exists we can assume we don't need to recreate it.
|
# exists we can assume we don't need to recreate it.
|
||||||
new_branch_name = f'update-v{version}-{source_branch_short_sha}'
|
new_branch_name = f'{branch_prefix}-v{version}-{source_branch_short_sha}'
|
||||||
print(f'Branch name is {new_branch_name}.')
|
print(f'Branch name is {new_branch_name}.')
|
||||||
|
|
||||||
# Check if the branch already exists. If so we can abort as this script
|
# Check if the branch already exists. If so we can abort as this script
|
||||||
|
|||||||
42
.github/workflows/pr-checks.yml
vendored
42
.github/workflows/pr-checks.yml
vendored
@@ -114,3 +114,45 @@ jobs:
|
|||||||
# we won't be able to find them on Windows.
|
# we won't be able to find them on Windows.
|
||||||
npm config set script-shell bash
|
npm config set script-shell bash
|
||||||
npm test
|
npm test
|
||||||
|
|
||||||
|
check-backport-node-versions:
|
||||||
|
if: ${{ github.event.pull_request }}
|
||||||
|
name: Check node version for backports
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 45
|
||||||
|
env:
|
||||||
|
BASE_REF: ${{ github.event.pull_request.base }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- id: head-version
|
||||||
|
name: check HEAD node version
|
||||||
|
run: |
|
||||||
|
# NB we are matching the node version string both with and without single quotes
|
||||||
|
NODE_VERSION=$(find . -name "*.yml" -exec grep -oh "using: 'node[0-9][0-9]\|using: node[0-9][0-9]" {} \; | sed -e "s/using: '//g" -e "s/using: //g" | sort | uniq)
|
||||||
|
echo "NODE_VERSION: ${NODE_VERSION}"
|
||||||
|
if [[ $(echo "$NODE_VERSION" | wc -l) -gt 1 ]]; then
|
||||||
|
echo "Error: More than one node version used in actions."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "node_version=${NODE_VERSION}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- id: checkout-base
|
||||||
|
name: check out base ref for backport check
|
||||||
|
if: ${{ startsWith(github.ref_name, 'backport-v') }}
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ env.BASE_REF }}
|
||||||
|
|
||||||
|
- name: compare with node version on base ref for backport check
|
||||||
|
if: steps.checkout-base.outcome == 'success'
|
||||||
|
env:
|
||||||
|
HEAD_VERSION: ${{ steps.head-version.outputs.node_version }}
|
||||||
|
run: |
|
||||||
|
BASE_VERSION=$(find . -name "*.yml" -exec grep -oh "using: 'node[0-9][0-9]\|using: node[0-9][0-9]" {} \; | sed -e "s/using: '//g" -e "s/using: //g" | sort | uniq)
|
||||||
|
echo "HEAD_VERSION: ${HEAD_VERSION}"
|
||||||
|
echo "BASE_VERSION: ${BASE_VERSION}"
|
||||||
|
if [[ "$BASE_VERSION" != "$HEAD_VERSION" ]]; then
|
||||||
|
echo "Error: Cannot change node version in a backport PR."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user