From 420d7f1ceac38d7155332afc9a2147b0482384eb Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 28 Oct 2022 13:49:19 +0200 Subject: [PATCH] ci: add option to skip status checks for releases --- .github/workflows/release.yml | 9 +++++++-- release/release.py | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b323105ae..316b40c04 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,9 +4,14 @@ on: workflow_dispatch: inputs: version: - description: 'The version to release (major.minor.patch)' + description: 'Version (major.minor.patch)' required: true type: string + skip-branch-status-check: + description: 'Skip CI status check.' + default: false + required: false + type: boolean permissions: actions: write @@ -34,4 +39,4 @@ jobs: - uses: actions/setup-python@v4 with: python-version-file: .github/python-version.txt - - run: ./release/release.py ${{ inputs.version }} + - run: ./release/release.py ${{ inputs.version }} ${{ inputs.skip-branch-status-check }} diff --git a/release/release.py b/release/release.py index b3c7b7a4c..a26daebdb 100755 --- a/release/release.py +++ b/release/release.py @@ -37,6 +37,8 @@ if __name__ == "__main__": assert re.match(r"^\d+\.\d+\.\d+$", version) major_version = int(version.split(".")[0]) + skip_branch_status_check = sys.argv[2] == "true" + branch = subprocess.run( ["git", "branch", "--show-current"], cwd=root, check=True, capture_output=True, text=True @@ -45,8 +47,11 @@ if __name__ == "__main__": print("➡️ Working dir clean?") assert not subprocess.run(["git", "status", "--porcelain"]).stdout - print(f"➡️ CI is passing for {branch}?") - assert get_json(f"https://api.github.com/repos/mitmproxy/mitmproxy/commits/{branch}/status")["state"] == "success" + if skip_branch_status_check: + print(f"⚠️ Skipping status check for {branch}.") + else: + print(f"➡️ CI is passing for {branch}?") + assert get_json(f"https://api.github.com/repos/mitmproxy/mitmproxy/commits/{branch}/status")["state"] == "success" print("➡️ Updating CHANGELOG.md...") changelog = root / "CHANGELOG.md"