Skip to content

Commit 35b10b5

Browse files
committed
Merge branch 'main' into henrymercer/drop-codeql-v2.11.5
2 parents 5dc8134 + ee9b8ab commit 35b10b5

File tree

619 files changed

+69085
-7380
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

619 files changed

+69085
-7380
lines changed

.github/actions/check-sarif/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ inputs:
1616
Comma separated list of query ids that should NOT be included in this SARIF file.
1717
1818
runs:
19-
using: node16
19+
using: node20
2020
main: index.js
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: 'Release branches'
2+
description: 'Determine branches for release & backport'
3+
inputs:
4+
major_version:
5+
description: 'The version as extracted from the package.json file'
6+
required: true
7+
latest_tag:
8+
description: 'The most recent tag published to the repository'
9+
required: true
10+
outputs:
11+
backport_source_branch:
12+
description: "The release branch for the given tag"
13+
value: ${{ steps.branches.outputs.backport_source_branch }}
14+
backport_target_branches:
15+
description: "JSON encoded list of branches to target with backports"
16+
value: ${{ steps.branches.outputs.backport_target_branches }}
17+
runs:
18+
using: "composite"
19+
steps:
20+
- id: branches
21+
run: |
22+
python ${{ github.action_path }}/release-branches.py \
23+
--major-version ${{ inputs.major_version }} \
24+
--latest-tag ${{ inputs.latest_tag }}
25+
shell: bash
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import argparse
2+
import json
3+
import os
4+
import configparser
5+
6+
# Name of the remote
7+
ORIGIN = 'origin'
8+
9+
script_dir = os.path.dirname(os.path.realpath(__file__))
10+
grandparent_dir = os.path.dirname(os.path.dirname(script_dir))
11+
12+
config = configparser.ConfigParser()
13+
with open(os.path.join(grandparent_dir, 'releases.ini')) as stream:
14+
config.read_string('[default]\n' + stream.read())
15+
16+
OLDEST_SUPPORTED_MAJOR_VERSION = int(config['default']['OLDEST_SUPPORTED_MAJOR_VERSION'])
17+
18+
def main():
19+
20+
parser = argparse.ArgumentParser()
21+
parser.add_argument("--major-version", required=True, type=str, help="The major version of the release")
22+
parser.add_argument("--latest-tag", required=True, type=str, help="The most recent tag published to the repository")
23+
args = parser.parse_args()
24+
25+
major_version = args.major_version
26+
latest_tag = args.latest_tag
27+
28+
print("major_version: " + major_version)
29+
print("latest_tag: " + latest_tag)
30+
31+
# If this is a primary release, we backport to all supported branches,
32+
# so we check whether the major_version taken from the package.json
33+
# is greater than or equal to the latest tag pulled from the repo.
34+
# For example...
35+
# 'v1' >= 'v2' is False # we're operating from an older release branch and should not backport
36+
# 'v2' >= 'v2' is True # the normal case where we're updating the current version
37+
# 'v3' >= 'v2' is True # in this case we are making the first release of a new major version
38+
consider_backports = ( major_version >= latest_tag.split(".")[0] )
39+
40+
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
41+
42+
f.write(f"backport_source_branch=releases/{major_version}\n")
43+
44+
backport_target_branches = []
45+
46+
if consider_backports:
47+
for i in range(int(major_version.strip("v"))-1, 0, -1):
48+
branch_name = f"releases/v{i}"
49+
if i >= OLDEST_SUPPORTED_MAJOR_VERSION:
50+
backport_target_branches.append(branch_name)
51+
52+
f.write("backport_target_branches="+json.dumps(backport_target_branches)+"\n")
53+
54+
if __name__ == "__main__":
55+
main()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: 'Prepare release job'
2+
description: 'Prepare for updating a release branch'
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
8+
- name: Dump environment
9+
run: env
10+
shell: bash
11+
12+
- name: Dump GitHub context
13+
env:
14+
GITHUB_CONTEXT: '${{ toJson(github) }}'
15+
run: echo "$GITHUB_CONTEXT"
16+
shell: bash
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: 3.8
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install PyGithub==1.55 requests
27+
shell: bash
28+
29+
- name: Update git config
30+
run: |
31+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
32+
git config --global user.name "github-actions[bot]"
33+
shell: bash

.github/releases.ini

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
OLDEST_SUPPORTED_MAJOR_VERSION=2

0 commit comments

Comments
 (0)