Skip to content

Commit 97847a4

Browse files
authored
Merge branch 'main' into mergeback/v2.1.10-to-main-2f58583a
2 parents f8c88ab + c4fdf5f commit 97847a4

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

CONTRIBUTING.md

+4-16
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,11 @@ Here are a few things you can do that will increase the likelihood of your pull
8080

8181
## Keeping the PR checks up to date (admin access required)
8282

83-
Since the `codeql-action` runs most of its testing through individual Actions workflows, there are over two hundred jobs that need to pass in order for a PR to turn green. You can regenerate the checks automatically by running the [Update required checks](.github/workflows/update-required-checks.yml) workflow.
83+
Since the `codeql-action` runs most of its testing through individual Actions workflows, there are over two hundred jobs that need to pass in order for a PR to turn green. You can regenerate the checks automatically by running the [update-required-checks.sh](.github/workflows/script/update-required-checks.sh) script:
8484

85-
Or you can use this semi-automated approach:
86-
87-
1. In a terminal check out the `SHA` whose checks you want to use as the base. Typically, this will be `main`.
88-
2. From a terminal, run the following commands:
89-
90-
```sh
91-
SHA="$(git rev-parse HEAD)"
92-
CHECKS="$(gh api repos/github/codeql-action/commits/${SHA}/check-runs --paginate | jq --slurp --compact-output --raw-output '[.[].check_runs | .[].name | select(contains("https://") or . == "CodeQL" or . == "LGTM.com" or . == "Update dependencies" or . == "Update Supported Enterprise Server Versions" | not)]')"
93-
echo "{\"contexts\": ${CHECKS}}" > checks.json
94-
gh api -X "PATCH" repos/github/codeql-action/branches/main/protection/required_status_checks --input checks.json
95-
gh api -X "PATCH" repos/github/codeql-action/branches/releases/v2/protection/required_status_checks --input checks.json
96-
gh api -X "PATCH" repos/github/codeql-action/branches/releases/v1/protection/required_status_checks --input checks.json
97-
````
98-
99-
3. Go to the [branch protection rules settings page](https://github.com/github/codeql-action/settings/branches) and validate that the rules have been updated.
85+
1. By default, this script retrieves the checks from the latest SHA on `main`, so make sure that your `main` branch is up to date.
86+
2. Run the script. If there's a reason to, you can pass in a different SHA as a CLI argument.
87+
3. After running, go to the [branch protection rules settings page](https://github.com/github/codeql-action/settings/branches) and validate that the rules for `main`, `v1`, and `v2` have been updated.
10088

10189
## Resources
10290

node_modules/.package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python-setup/install_tools.sh

+10-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,16 @@ python3 -m pip install --user poetry!=1.0.10
2929
python3 -m pip install --user pipenv
3030

3131
if command -v python2 >/dev/null 2>&1; then
32-
# Setup Python 2 dependency installation tools.
33-
# The Ubuntu 20.04 GHA environment does not come with a Python 2 pip
34-
curl --location --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2
32+
# Setup Python 2 dependency installation tools. The Ubuntu 20.04 GHA environment
33+
# does not come with a Python 2 pip, but if it is already installed, don't try to
34+
# install it again (since that causes problems).
35+
#
36+
# This might seem like a hypothetical situation, but it happens all the time in our
37+
# internal testing where we run the action twice in a row.
38+
if ! python2 -m pip --version; then
39+
echo "Will install pip for python2"
40+
curl --location --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2
41+
fi
3542

3643
python2 -m pip install --user --upgrade pip setuptools wheel
3744

0 commit comments

Comments
 (0)