Skip to content

Commit

Permalink
[MNT] Fix certain workflow actions for forks and add button for reset…
Browse files Browse the repository at this point in the history
…ting CI (#1764)

* [MNT] Bot to make empty commits (#15)

* CI fun

* comments and token

* [MNT] empty commit PR 2 (#16)

* CI fun

* comments and token

* comments

* skip dirty check

* Empty commit for CI

* empty comment 3 (#17)

* comment

* prs only

* comment

* Empty commit for CI

* empty commit 4 (#18)

* comment

* correct branch

* Empty commit for CI

* empty commit 5 (#19)

* comment

* branch

* empty commit 6 (#20)

* [BUG] fix padder fit_values (#1752)

* fix padder

* declare var

* [DOC,MNT] Documentation updates and deprecation warning for `v1.0.0` (#1743)

* forecasting docs

* v1.0.0 mass deprecation message

* index fix

* installation

* typos

* comment

* pushing to forks is crazy

* dont create branches

* [MNT] Unit testing revamp part 1: `check_estimator` (#1479)

* remove no soft deps job and expand full no soft deps job

* no PR testing flag

* module soft deps

* is this actually returning an empty list

* import modules now

* clear out module soft dep

* check_estimator

* check_estimator updates

* import

* more complete functions and tests

* fix

* coverage and paramterize function test

* testing data start

* testing data start

* testing data cont

* real partial

* cont

* testing data changes

* examples revert

* fourier features

* Revert "fourier features"

This reverts commit 567c5e1.

* legacy skip

* init

* move to legacy

* example data update

* testing data

* imports

* examples

* testing update

* multiindex

* multiindex fixes

* multiindex returns

* test

* test

* docs, tests and fixes

* comments

* last bits

* refactor testing folder

* imports

* series generators

* fixes

* make_series legacy

* merge

* forecasting functions

* fixes

* fixes

* fixes

* testing

* examples

* convert checks

* fixes

* docs

* ad datasets

* more docs

* forecasting compose

* forecasting

* delete forecasting api docs

* docs

* revert and comment init

* imports

* import test

* uncomment

* docstrings

* no imports

* package name

* import

* docstring

* fixes

* remove legacy and doc fix

* [ENH] Channel selection rocket wrapper (#1504)

* base channel selector

* base channel selector

* random channel selector

* elbow class test

* random channel selector

* base channel selector

* base channel selector

* revert registry

* draft channel selector

* class method

* test channel scorer

* docstring

* remove unnecessary ExponentTransform import

* deprecate DateTime

* Revert "deprecate DateTime"

This reverts commit 98b29e6.

* channel selection

* remove dependency

* move tests to fit

* move tests to fit

* channel scorer test

* add to API

* maint

* maint

---------

Co-authored-by: Tony Bagnall <ajb@uea.ac.uk>

* empty commit 7 (#21)

* comment

* remove branch param

* fixes

* Empty commit for CI

* empty commit 8 (#22)

* comment

* repo and branch

* comment

* empty commit 9 (#23)

* [BUG] fix padder fit_values (#1752)

* fix padder

* declare var

* [DOC,MNT] Documentation updates and deprecation warning for `v1.0.0` (#1743)

* forecasting docs

* v1.0.0 mass deprecation message

* index fix

* installation

* typos

* [MNT] Unit testing revamp part 1: `check_estimator` (#1479)

* remove no soft deps job and expand full no soft deps job

* no PR testing flag

* module soft deps

* is this actually returning an empty list

* import modules now

* clear out module soft dep

* check_estimator

* check_estimator updates

* import

* more complete functions and tests

* fix

* coverage and paramterize function test

* testing data start

* testing data start

* testing data cont

* real partial

* cont

* testing data changes

* examples revert

* fourier features

* Revert "fourier features"

This reverts commit 567c5e1.

* legacy skip

* init

* move to legacy

* example data update

* testing data

* imports

* examples

* testing update

* multiindex

* multiindex fixes

* multiindex returns

* test

* test

* docs, tests and fixes

* comments

* last bits

* refactor testing folder

* imports

* series generators

* fixes

* make_series legacy

* merge

* forecasting functions

* fixes

* fixes

* fixes

* testing

* examples

* convert checks

* fixes

* docs

* ad datasets

* more docs

* forecasting compose

* forecasting

* delete forecasting api docs

* docs

* revert and comment init

* imports

* import test

* uncomment

* docstrings

* no imports

* package name

* import

* docstring

* fixes

* remove legacy and doc fix

* [ENH] Channel selection rocket wrapper (#1504)

* base channel selector

* base channel selector

* random channel selector

* elbow class test

* random channel selector

* base channel selector

* base channel selector

* revert registry

* draft channel selector

* class method

* test channel scorer

* docstring

* remove unnecessary ExponentTransform import

* deprecate DateTime

* Revert "deprecate DateTime"

This reverts commit 98b29e6.

* channel selection

* remove dependency

* move tests to fit

* move tests to fit

* channel scorer test

* add to API

* [DEP] Exclusion list  (#1730)

* remove dependency

* excluded list

* [MNT] Removing `tensorflow_addons` dependency (#1421)

* tensorflow bound

* add manually instance normalization

* empty commit

* fix doxs

* fix bug

* add maintainer

* re arrange

* dep on utils

* fix comments

* add version and file to header

* re add conflict

* remove addon

* only adodn remove

* add typeguard dep

* remove addons from test

* remove tag of python<3.12 from base class

* edit pyptoject for test details

* remove typeguard

* remove addons

* remove typeguard

* fix bug in python version

* remove config on python < 3.12

* remove python version from test

* remove python version from base

* use group norm

* re-add 3.12 limit

* remove tags and add python version

* skip random state clr test

* fix test all networks

* set y for channel selection test

* set y for channel selection test

---------

Co-authored-by: hadifawaz1999 <hadifawaz2291999@gmail.com>
Co-authored-by: Tony Bagnall <ajb@uea.ac.uk>

* comment

* Empty commit for CI

* uncomment

---------

Co-authored-by: Tony Bagnall <ajb@uea.ac.uk>
Co-authored-by: hadifawaz1999 <hadifawaz2291999@gmail.com>
Co-authored-by: MatthewMiddlehurst <MatthewMiddlehurst@users.noreply.github.com>

---------

Co-authored-by: MatthewMiddlehurst <MatthewMiddlehurst@users.noreply.github.com>
Co-authored-by: Tony Bagnall <ajb@uea.ac.uk>
Co-authored-by: hadifawaz1999 <hadifawaz2291999@gmail.com>
  • Loading branch information
4 people authored Jul 9, 2024
1 parent 9bb6c99 commit 027d651
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -2349,7 +2349,7 @@
"code",
"doc",
"research",
"tests",
"test",
"review",
"data"
]
Expand Down
48 changes: 36 additions & 12 deletions .github/workflows/issue_comment_edited.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
name: Issue Comment Posted
name: Issue Comment Edited

on:
issue_comment:
types: [edited]

concurrency:
group: ${{ github.workflow }}-${{ github.event.comment.id }}
cancel-in-progress: true

jobs:
check-pr-labels:
pr-welcome-edited:
if: ${{ github.event.issue.pull_request }}
runs-on: ubuntu-20.04

steps:
- name: Checkout
- name: Create app token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.PR_APP_ID }}
private-key: ${{ secrets.PR_APP_KEY }}

- name: Checkout main
uses: actions/checkout@v4
with:
sparse-checkout: build_tools
Expand All @@ -22,15 +34,27 @@ jobs:
- name: Install PyGithub
run: pip install -Uq PyGithub

- name: Create app token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.PR_APP_ID }}
private-key: ${{ secrets.PR_APP_KEY }}

- name: Assign issue
run: python build_tools/comment_pr_labeler.py
- name: Process comment edit
id: label_out
run: python build_tools/pr_welcome_edited.py
env:
CONTEXT_GITHUB: ${{ toJson(github) }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

- if: ${{ steps.label_out.outputs.empty_commit == 'true' }}
name: Checkout head
uses: actions/checkout@v4
with:
repository: ${{ steps.label_out.outputs.repo }}
ref: ${{ steps.label_out.outputs.branch }}
token: ${{ steps.app-token.outputs.token }}

- if: ${{ steps.label_out.outputs.empty_commit == 'true' }}
name: Push empty commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Empty commit for CI
commit_user_name: aeon-actions-bot[bot]
commit_options: --allow-empty
create_branch: false
skip_dirty_check: true
2 changes: 1 addition & 1 deletion .github/workflows/periodic_github_maintenace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
private-key: ${{ secrets.PR_APP_KEY }}

- name: Stale Branches
uses: crs-k/stale-branches@v5
uses: crs-k/stale-branches@v5.0.1
with:
repo-token: ${{ steps.app-token.outputs.token }}
days-before-stale: 140
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/pr_precommit.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: PR pre-commit

on:
push:
branches:
- main
pull_request_target:
branches:
- main
Expand All @@ -24,7 +27,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
token: ${{ steps.app-token.outputs.token }}

- name: Setup Python 3.10
Expand All @@ -50,9 +54,10 @@ jobs:
with:
extra_args: --files ${{ steps.changed-files.outputs.all_changed_files }}

- if: ${{ failure() && github.event_name == 'pull_request_target' && github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'stop pre-commit fixes')}}
- if: ${{ failure() && github.event_name == 'pull_request_target' && !github.event.pull_request.draft && !contains(github.event.pull_request.labels.*.name, 'stop pre-commit fixes') }}
name: Push pre-commit fixes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Automatic `pre-commit` fixes
commit_user_name: aeon-actions-bot[bot]
create_branch: false
2 changes: 1 addition & 1 deletion .github/workflows/precommit_autoupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
python-version: "3.10"

- uses: browniebroke/pre-commit-autoupdate-action@v1
- uses: browniebroke/pre-commit-autoupdate-action@v1.0.0

- if: always()
name: Create app token
Expand Down
46 changes: 0 additions & 46 deletions build_tools/comment_pr_labeler.py

This file was deleted.

1 change: 1 addition & 0 deletions build_tools/pr_open_commenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,6 @@
- [ ] Run all notebook example tests
- [ ] Run numba-disabled `codecov` tests
- [ ] Stop automatic `pre-commit` fixes (always disabled for drafts)
- [ ] Push an empty commit to re-run CI checks
""" # noqa
)
78 changes: 78 additions & 0 deletions build_tools/pr_welcome_edited.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
"""Labels PRs and process based on bot comment checkboxes."""

import json
import os
import sys

from github import Github

context_dict = json.loads(os.getenv("CONTEXT_GITHUB"))

repo = context_dict["repository"]
g = Github(os.getenv("GITHUB_TOKEN"))
repo = g.get_repo(repo)
issue_number = context_dict["event"]["issue"]["number"]
issue = repo.get_issue(number=issue_number)
comment_body = context_dict["event"]["comment"]["body"]
comment_user = context_dict["event"]["comment"]["user"]["login"]
labels = [label.name for label in issue.get_labels()]

if (
issue.pull_request is None
or comment_user != "aeon-actions-bot[bot]"
or "## Thank you for contributing to `aeon`" not in comment_body
):
with open(os.environ["GITHUB_OUTPUT"], "a") as fh:
print("empty_commit=false", file=fh) # noqa: T201
sys.exit(0)
pr = issue.as_pull_request()


def check_label_option(label, option):
"""Add or remove a label based on a checkbox in a comment."""
if f"- [x] {option}" in comment_body:
if label not in labels:
pr.add_to_labels(label)
elif f"- [ ] {option}" in comment_body:
if label in labels:
pr.remove_from_labels(label)


label_options = [
("full pre-commit", "Run `pre-commit` checks for all files"),
("full pytest actions", "Run all `pytest` tests and configurations"),
("full examples run", "Run all notebook example tests"),
("codecov actions", "Run numba-disabled `codecov` tests"),
(
"stop pre-commit fixes",
"Stop automatic `pre-commit` fixes (always disabled for drafts)",
),
]

for option in label_options:
check_label_option(option[0], option[1])

repo_name = pr.head.repo.full_name
branch_name = pr.head.ref
with open(os.environ["GITHUB_OUTPUT"], "a") as fh:
print(f"repo={repo_name}", file=fh) # noqa: T201
print(f"branch={branch_name}", file=fh) # noqa: T201

if "- [x] Push an empty commit to re-run CI checks" in comment_body:
for comment in pr.get_comments():
if (
comment.user.login == comment_user
and "## Thank you for contributing to `aeon`" in comment.body
):
comment.edit(
comment_body.replace(
"- [x] Push an empty commit to re-run CI checks",
"- [ ] Push an empty commit to re-run CI checks",
)
)
break
with open(os.environ["GITHUB_OUTPUT"], "a") as fh:
print("empty_commit=true", file=fh) # noqa: T201
else:
with open(os.environ["GITHUB_OUTPUT"], "a") as fh:
print("empty_commit=false", file=fh) # noqa: T201

0 comments on commit 027d651

Please sign in to comment.