forked from github/codeql-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from nickfyson-org/update-v3.22.9-fe8aa9a61
Merge main into releases/v3
- Loading branch information
Showing
231 changed files
with
1,346 additions
and
524 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: 'Release branches' | ||
description: 'Determine branches for release & backport' | ||
inputs: | ||
major_version: | ||
description: 'The version as extracted from the package.json file' | ||
required: true | ||
latest_tag: | ||
description: 'The most recent tag published to the repository' | ||
required: true | ||
outputs: | ||
backport_source_branch: | ||
description: "The release branch for the given tag" | ||
value: ${{ steps.branches.outputs.backport_source_branch }} | ||
backport_target_branches: | ||
description: "JSON encoded list of branches to target with backports" | ||
value: ${{ steps.branches.outputs.backport_target_branches }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- id: branches | ||
run: | | ||
python ${{ github.action_path }}/release-branches.py \ | ||
--major-version ${{ inputs.major_version }} \ | ||
--latest-tag ${{ inputs.latest_tag }} | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import argparse | ||
import os, json | ||
import subprocess | ||
|
||
# Name of the remote | ||
ORIGIN = 'origin' | ||
|
||
OLDEST_SUPPORTED_MAJOR_VERSION = 2 | ||
|
||
# Runs git with the given args and returns the stdout. | ||
# Raises an error if git does not exit successfully (unless passed | ||
# allow_non_zero_exit_code=True). | ||
def run_git(*args, allow_non_zero_exit_code=False): | ||
cmd = ['git', *args] | ||
p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
if not allow_non_zero_exit_code and p.returncode != 0: | ||
raise Exception(f'Call to {" ".join(cmd)} exited with code {p.returncode} stderr: {p.stderr.decode("ascii")}.') | ||
return p.stdout.decode('ascii') | ||
|
||
def main(): | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--major-version", required=True, type=str, help="The major version of the release") | ||
parser.add_argument("--latest-tag", required=True, type=str, help="The most recent tag published to the repository") | ||
args = parser.parse_args() | ||
|
||
major_version = args.major_version | ||
latest_tag = args.latest_tag | ||
|
||
print("major_version: " + major_version) | ||
print("latest_tag: " + latest_tag) | ||
|
||
# If this is a primary release, we backport to all supported branches, | ||
# so we check whether the major_version taken from the package.json | ||
# is greater than or equal to the latest tag pulled from the repo. | ||
# For example... | ||
# 'v1' >= 'v2' is False # we're operating from an older release branch and should not backport | ||
# 'v2' >= 'v2' is True # the normal case where we're updating the current version | ||
# 'v3' >= 'v2' is True # in this case we are making the first release of a new major version | ||
consider_backports = ( major_version >= latest_tag.split(".")[0] ) | ||
|
||
with open(os.environ["GITHUB_OUTPUT"], "a") as f: | ||
|
||
f.write(f"backport_source_branch=releases/{major_version}\n") | ||
|
||
backport_target_branches = [] | ||
|
||
if consider_backports: | ||
for i in range(int(major_version.strip("v"))-1, 0, -1): | ||
branch_name = f"releases/v{i}" | ||
if i >= OLDEST_SUPPORTED_MAJOR_VERSION: | ||
backport_target_branches.append(branch_name) | ||
|
||
f.write("backport_target_branches="+json.dumps(backport_target_branches)+"\n") | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: 'Prepare release job' | ||
description: 'Executed preparatory steps before update a release branch' | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
|
||
- name: Dump environment | ||
run: env | ||
shell: bash | ||
|
||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: '${{ toJson(github) }}' | ||
run: echo "$GITHUB_CONTEXT" | ||
shell: bash | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install PyGithub==1.55 requests | ||
shell: bash | ||
|
||
- name: Update git config | ||
run: | | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "github-actions[bot]" | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
### Merge / deployment checklist | ||
|
||
- [ ] Confirm this change is backwards compatible with existing workflows. | ||
- [ ] Confirm the [readme](https://github.com/github/codeql-action/blob/main/README.md) has been updated if necessary. | ||
- [ ] Confirm the [changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) has been updated if necessary. | ||
- [ ] Confirm the [readme](https://github.com/nickfyson-org/codeql-action/blob/main/README.md) has been updated if necessary. | ||
- [ ] Confirm the [changelog](https://github.com/nickfyson-org/codeql-action/blob/main/CHANGELOG.md) has been updated if necessary. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.