From 6698bbf68fc5cd50ba1dd05d0dc5eca13afa0ac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 13 Jan 2021 15:46:12 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=91=B7=20Add=20PR=20automation=20work?= =?UTF-8?q?flow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Will help us label PRs based on their contents, and then that info can be used to make the whole branch validation a bit more intelligent. For reasons of consistency, also rename issue labeler to issue automation. --- .github/labeler.yml | 25 +++++++++++++++++++ ...issue_labeler.yml => issue_automation.yml} | 4 +-- .github/workflows/pr_automation.yml | 11 ++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 .github/labeler.yml rename .github/workflows/{issue_labeler.yml => issue_automation.yml} (97%) create mode 100644 .github/workflows/pr_automation.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 000000000..ed3f1c77a --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,25 @@ +docs: + - "docs/*" + - "docs/**/*" + - "README.md" + +meta: + - "CODE_OF_CONDUCT.md" + - "CONTRIBUTING.md" + - "SECURITY.md" + - ".github/CODEOWNERS" + - ".github/FUNDING.yml" + - ".github/ISSUE_TEMPLATE/*" + - ".github/PULL_REQUEST_TEMPLATE.md" + +ci/cd: + - ".github/fixtures/**/*" + - ".github/workflows/*" + - ".github/labeler.yml" + +docker: + - ".github/workflows/trigger_docker.yml" + +tests: + - "tests/*" + - "tests/**/*" diff --git a/.github/workflows/issue_labeler.yml b/.github/workflows/issue_automation.yml similarity index 97% rename from .github/workflows/issue_labeler.yml rename to .github/workflows/issue_automation.yml index 5b6e026e7..f3024d73f 100644 --- a/.github/workflows/issue_labeler.yml +++ b/.github/workflows/issue_automation.yml @@ -1,10 +1,10 @@ -name: "Issue Labeler" +name: "Issue Automation" on: issues: types: [opened, edited, closed, reopened] jobs: - label-opened-and-edited: + label: runs-on: ubuntu-latest steps: - uses: actions/github-script@v2 diff --git a/.github/workflows/pr_automation.yml b/.github/workflows/pr_automation.yml new file mode 100644 index 000000000..ee0b8832f --- /dev/null +++ b/.github/workflows/pr_automation.yml @@ -0,0 +1,11 @@ +name: "Pull Request Automation" +on: + - pull_request_target + +jobs: + label: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v3 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" From 9d3437bd373cf7ff036b9e2815adf9907a81eb84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 14 Jan 2021 16:08:13 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=91=B7=20Implement=20pr=20check=20via?= =?UTF-8?q?=20GH=20Action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/pr-validation.yml | 14 ++++++++++++++ .github/workflows/pr_automation.yml | 11 ++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .github/pr-validation.yml diff --git a/.github/pr-validation.yml b/.github/pr-validation.yml new file mode 100644 index 000000000..b6644f25c --- /dev/null +++ b/.github/pr-validation.yml @@ -0,0 +1,14 @@ +approve_label: "approved" +problem_label: "needs some work" + +allowed_targets: ["maintenance", "devel", "staging/maintenance", "staging/devel"] +forbidden_sources: + ["master", "maintenance", "devel", "staging/maintenance", "staging/devel"] + +labels: + docs: + additional_allowed_targets: ["master"] + meta: + additional_allowed_targets: ["master"] + ci/cd: + additional_allowed_targets: ["master"] diff --git a/.github/workflows/pr_automation.yml b/.github/workflows/pr_automation.yml index ee0b8832f..e770708a0 100644 --- a/.github/workflows/pr_automation.yml +++ b/.github/workflows/pr_automation.yml @@ -1,6 +1,7 @@ name: "Pull Request Automation" on: - - pull_request_target + pull_request_target: + types: ["opened", "synchronize", "reopened", "edited", "labeled", "unlabeled"] jobs: label: @@ -9,3 +10,11 @@ jobs: - uses: actions/labeler@v3 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" + + validate: + runs-on: ubuntu-latest + needs: label + steps: + - uses: OctoPrint/actions/pr-validation@main + with: + github-token: ${{ secrets.GITHUB_TOKEN }}