From b30cf4859a65d0a3d42270cb098896d05eab9668 Mon Sep 17 00:00:00 2001 From: Marco Pfatschbacher Date: Wed, 8 Nov 2023 15:34:50 +0000 Subject: [PATCH 1/2] Request a dispatched PR build (#17200) * Request a dispatched PR build Dispatch a PR build to graylog-project-internal. Provide all the necessary informations so that the dispatched build can update the commit status on the calling PR. * Simplify building PR dependencies string Co-authored-by: Bernd Ahlers * get pr_nr directoy from the github event * ignore grep failure on missing /jpd * fix wrong braces * avoid logging the entire pr body in the build output --------- Co-authored-by: Bernd Ahlers --- .github/workflows/dispatch-pr-build.yml | 47 +++++++++++++++++++++++++ 1 file changed, 47 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 000000000000..3d1bc996ebc5 --- /dev/null +++ b/.github/workflows/dispatch-pr-build.yml @@ -0,0 +1,47 @@ +name: Request dispatched PR Build + +on: + - pull_request + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + dispatchedPR: + name: Dispatch wait and check + runs-on: ubuntu-latest + + steps: + - name: Build pull requests string + id: pr_string + shell: bash + env: + PR_BODY: "${{ github.event.pull_request.body }}" + run: | + # Add the PR that triggered this workflow + pulls=("${{ github.repository }}#${{ github.event.number }}") + + # Add any PR dependencies to the list of pulls + pulls+=($(grep -P '^/(jenkins-pr-deps|jpd|prd)' <<< "$PR_BODY" | \ + grep -ioP '(Graylog2/\S+?#|https?://github.com/Graylog2/\S+?/pull/)[0-9]+' || true)) + + echo "pr_string=$(tr ' ' ',' <<< "${pulls[@]}")" >> $GITHUB_OUTPUT + + - name: dispatch job to graylog-project-internal + run: > + gh workflow run -R Graylog2/graylog-project-internal pr-build.yml + -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 pull_requests="${{ steps.pr_string.outputs.pr_string }}" + -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 72897fb2b660eaa0b5341aeb2a50af4209ad74ff Mon Sep 17 00:00:00 2001 From: Marco Pfatschbacher Date: Wed, 8 Nov 2023 15:35:41 +0000 Subject: [PATCH 2/2] Add changelog check workflow (#17202) * Add changelog check workflow * add changelog * Revert "add changelog" This reverts commit 095e75be6f9322eff52b9d18f65a64c11802813c. * no need to retrigger the check on issue comments --- .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 000000000000..62fa478bb56c --- /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"