From 5424ed695f8fb79c1da01d762ea198039aef6675 Mon Sep 17 00:00:00 2001 From: Marco Pfatschbacher Date: Tue, 28 Nov 2023 11:41:25 +0000 Subject: [PATCH 1/2] Add github action PR build for 5.0 --- .github/workflows/dispatch-pr-build.yml | 52 +++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/dispatch-pr-build.yml diff --git a/.github/workflows/dispatch-pr-build.yml b/.github/workflows/dispatch-pr-build.yml new file mode 100644 index 00000000..5b56e9f3 --- /dev/null +++ b/.github/workflows/dispatch-pr-build.yml @@ -0,0 +1,52 @@ +name: Request dispatched PR Build + +on: + pull_request: + types: [ opened, reopened, synchronize, edited ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + dispatchedPR: + name: Dispatch wait and check + runs-on: ubuntu-latest + + steps: + - name: Check if PR edit changed deps string + if: ${{ github.event.action == 'edited' }} + id: pr-string-changed + continue-on-error: true + run: | + old_pr_string=$(grep -P '^/(jenkins-pr-deps|jpd|prd)' <<< "$OLD_PR_BODY" | \ + grep -ioP '(Graylog2/\S+?#|https?://github.com/Graylog2/\S+?/pull/)[0-9]+' || true) + new_pr_string=$(grep -P '^/(jenkins-pr-deps|jpd|prd)' <<< "$NEW_PR_BODY" | \ + grep -ioP '(Graylog2/\S+?#|https?://github.com/Graylog2/\S+?/pull/)[0-9]+' || true) + if [ "$old_pr_string" != "$new_pr_string" ]; then + echo "PR deps string change detected: \"$old_pr_string\" -> \"$new_pr_string\"" + echo "Re-triggering PR build..." + exit 0 + fi + exit 1 + env: + OLD_PR_BODY: "${{ github.event.changes.body.from }}" + NEW_PR_BODY: "${{ github.event.pull_request.body }}" + + - name: dispatch job to graylog-project-internal + if: ${{ github.event.action != 'edited' || steps.pr-string-changed.outcome == 'success' }} + run: > + gh workflow run -R Graylog2/graylog-project-internal pr-build.yml --ref master + -f caller_repo=${{ github.repository }} + -f caller_pr_nr=${{ github.event.number }} + -f caller_base_branch=${{ github.base_ref || github.ref_name }} + -f caller_head_branch=${{ github.head_ref }} + -f head_sha=${{ github.event.pull_request.head.sha }} + -f initial_actor="${{ github.actor }}/${{ github.triggering_actor }}" + env: + GITHUB_TOKEN: ${{ secrets.PAT_GRAYLOG_PROJECT_INTERNAL_WORKFLOW_RW }} + + - name: Give dispatched build time to add its status + run: sleep 20 + # This is mostly cosmetic. If this workflow finishes before the dispatched + # build creates the status on the PR, the build will show up green for a while. From ebf2458c9280b3d39d70d3ae599c3d43cc3d32d0 Mon Sep 17 00:00:00 2001 From: Marco Pfatschbacher Date: Thu, 30 Nov 2023 09:24:36 +0000 Subject: [PATCH 2/2] add changelog check --- .github/workflows/changelog.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/changelog.yml diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 00000000..62fa478b --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,17 @@ +name: "Changelog Check" + +on: + pull_request: + types: + - "opened" + - "synchronize" + - "reopened" + - "edited" + +jobs: + test: + name: "Check Changelog presence" + runs-on: "ubuntu-latest" + + steps: + - uses: "Graylog2/actions/changelog-check@main"