Skip to content

Commit e3bfd25

Browse files
author
Simon Engledew
authored
Merge pull request #293 from github/update-v1-f13bd452
Merge main into v1
2 parents 935dd40 + f13bd45 commit e3bfd25

53 files changed

Lines changed: 475 additions & 89 deletions

Some content is hidden

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

.github/workflows/codeql.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v2
1717
- uses: ./init
18+
id: init
1819
with:
1920
languages: javascript
2021
config-file: ./.github/codeql/codeql-config.yml
22+
# confirm steps.init.outputs.codeql-path points to the codeql binary
23+
- name: Print CodeQL Version
24+
run: ${{steps.init.outputs.codeql-path}} version --format=json
2125
- uses: ./analyze

.github/workflows/python-deps.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444

4545
- name: Initialize CodeQL
4646
uses: ./init
47+
id: init
4748
with:
4849
tools: latest
4950
languages: python
@@ -62,8 +63,7 @@ jobs:
6263
esac
6364
echo ${basePath}
6465
65-
codeql_version="0.0.0-$(cat "$GITHUB_WORKSPACE/src/defaults.json" | jq -r .bundleVersion | rev | cut -d - -f 1 | rev)"
66-
$GITHUB_WORKSPACE/python-setup/auto_install_packages.py "${basePath}/hostedtoolcache/CodeQL/$codeql_version/x64/codeql"
66+
$GITHUB_WORKSPACE/python-setup/auto_install_packages.py "$(dirname ${{steps.init.outputs.codeql-path}})"
6767
- name: Setup for extractor
6868
run: |
6969
echo $CODEQL_PYTHON
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Update Supported Enterprise Server Versions
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
7+
jobs:
8+
update-supported-enterprise-server-versions:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Setup Python
13+
uses: actions/setup-python@v2
14+
with:
15+
python-version: "3.7"
16+
- name: Checkout CodeQL Action
17+
uses: actions/checkout@v2
18+
- name: Checkout Enterprise Releases
19+
uses: actions/checkout@v2
20+
with:
21+
repository: github/enterprise-releases
22+
ssh-key: ${{ secrets.ENTERPRISE_RELEASES_SSH_KEY }}
23+
path: ${{ github.workspace }}/enterprise-releases/
24+
- name: Update Supported Enterprise Server Versions
25+
run: |
26+
cd ./.github/workflows/update-supported-enterprise-server-versions/
27+
python3 -m pip install pipenv
28+
pipenv install
29+
pipenv run ./update.py
30+
rm --recursive "$ENTERPRISE_RELEASES_PATH"
31+
npm run build
32+
env:
33+
ENTERPRISE_RELEASES_PATH: ${{ github.workspace }}/enterprise-releases/
34+
- name: Commit Changes
35+
uses: peter-evans/create-pull-request@c7f493a8000b8aeb17a1332e326ba76b57cb83eb # v3.4.1
36+
with:
37+
commit-message: Update supported GitHub Enterprise Server versions.
38+
title: Update supported GitHub Enterprise Server versions.
39+
body: ""
40+
author: GitHub <noreply@github.com>
41+
branch: update-supported-enterprise-server-versions
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[[source]]
2+
name = "pypi"
3+
url = "https://pypi.org/simple"
4+
verify_ssl = true
5+
6+
[dev-packages]
7+
8+
[packages]
9+
semver = "*"

.github/workflows/update-supported-enterprise-server-versions/Pipfile.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env python3
2+
import datetime
3+
import json
4+
import os
5+
import pathlib
6+
7+
import semver
8+
9+
_API_COMPATIBILITY_PATH = pathlib.Path(__file__).absolute().parents[3] / "src" / "api-compatibility.json"
10+
_ENTERPRISE_RELEASES_PATH = pathlib.Path(os.environ["ENTERPRISE_RELEASES_PATH"])
11+
_RELEASE_FILE_PATH = _ENTERPRISE_RELEASES_PATH / "releases.json"
12+
_FIRST_SUPPORTED_RELEASE = semver.VersionInfo.parse("2.22.0") # Versions older than this did not include Code Scanning.
13+
14+
def main():
15+
api_compatibility_data = json.loads(_API_COMPATIBILITY_PATH.read_text())
16+
17+
releases = json.loads(_RELEASE_FILE_PATH.read_text())
18+
oldest_supported_release = None
19+
newest_supported_release = semver.VersionInfo.parse(api_compatibility_data["maximumVersion"] + ".0")
20+
21+
for release_version_string, release_data in releases.items():
22+
release_version = semver.VersionInfo.parse(release_version_string + ".0")
23+
if release_version < _FIRST_SUPPORTED_RELEASE:
24+
continue
25+
26+
if release_version > newest_supported_release:
27+
feature_freeze_date = datetime.date.fromisoformat(release_data["feature_freeze"])
28+
if feature_freeze_date < datetime.date.today() + datetime.timedelta(weeks=2):
29+
newest_supported_release = release_version
30+
31+
if oldest_supported_release is None or release_version < oldest_supported_release:
32+
end_of_life_date = datetime.date.fromisoformat(release_data["end"])
33+
if end_of_life_date > datetime.date.today():
34+
oldest_supported_release = release_version
35+
36+
api_compatibility_data = {
37+
"minimumVersion": f"{oldest_supported_release.major}.{oldest_supported_release.minor}",
38+
"maximumVersion": f"{newest_supported_release.major}.{newest_supported_release.minor}",
39+
}
40+
_API_COMPATIBILITY_PATH.write_text(json.dumps(api_compatibility_data, sort_keys=True) + "\n")
41+
42+
if __name__ == "__main__":
43+
main()

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ It is possible to run this action locally via [act](https://github.com/nektos/ac
3636

3737
```bash
3838
CODEQL_LOCAL_RUN=true
39+
GITHUB_SERVER_URL=https://github.com
3940

4041
# Optional, for better logging
4142
GITHUB_JOB=<ANY_JOB_NAME>

init/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ inputs:
2323
description: Try to auto-install your python dependencies
2424
required: true
2525
default: 'true'
26+
outputs:
27+
codeql-path:
28+
description: The path of the CodeQL binary used for analysis
2629
runs:
2730
using: 'node12'
2831
main: '../lib/init-action.js'

lib/actions-util.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/actions-util.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)