From 3d440d81ad9005cd38afc7701044ae8c4ec161ba Mon Sep 17 00:00:00 2001 From: Nicholas openSUSE Software Engineer Date: Mon, 4 Mar 2024 18:17:57 -0300 Subject: [PATCH] [release-v2.8] adding paths filtering code to validation-check (#3500) --- .github/workflows/pull-request.yaml | 14 ++++++------- .github/workflows/regsync-config.yaml | 12 +++++------ .github/workflows/validation-check.yaml | 25 ++++++++++++++++++++--- .github/workflows/validation-comment.yaml | 4 ++-- 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index b97b52c310..7768d4966e 100755 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout base branch - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Checkout PR run: gh pr checkout ${{ github.event.pull_request.number }} @@ -28,7 +28,7 @@ jobs: - name: Check release.yaml run: make check-release-yaml - - name: Validate + - name: Validate run: sudo make validate check-images: @@ -36,14 +36,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout base branch - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Checkout PR run: gh pr checkout ${{ github.event.pull_request.number }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Check container images + - name: Check container images run: make check-images env: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} @@ -54,7 +54,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout base branch - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Checkout PR run: gh pr checkout ${{ github.event.pull_request.number }} @@ -70,7 +70,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout base branch - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Checkout PR run: gh pr checkout ${{ github.event.pull_request.number }} @@ -78,4 +78,4 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run Hull tests - run: cd tests && go test -v ./... \ No newline at end of file + run: cd tests && go test -v ./... diff --git a/.github/workflows/regsync-config.yaml b/.github/workflows/regsync-config.yaml index d53a6de172..50d2f256d6 100644 --- a/.github/workflows/regsync-config.yaml +++ b/.github/workflows/regsync-config.yaml @@ -1,5 +1,5 @@ -# Generate-Regsync-Config action will run for every PR into release-v2.7 branch only after an approval is given -# It will run make target to generate regsync file and add a commit to the PR updating the regsync file. +# Generate-Regsync-Config action will run for every PR into release-v2.8 branch only after an approval is given +# It will run make target to generate regsync file and add a commit to the PR updating the regsync file. # It will then install and run regsync client and do the prime image mirroring. name: Generate-Regsync-Config @@ -33,10 +33,10 @@ jobs: if: needs.onLabelAndApproval.outputs.is_approved == 'true' runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v4 with: - token: ${{ secrets.PUSH_TOKEN }} + token: ${{ secrets.PUSH_TOKEN }} - name: Set-up Ruby 3.2 uses: ruby/setup-ruby@v1 @@ -85,4 +85,4 @@ jobs: env: REGISTRY_ENDPOINT: ${{ secrets.REGISTRY_ENDPOINT }} REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} - REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} \ No newline at end of file + REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} diff --git a/.github/workflows/validation-check.yaml b/.github/workflows/validation-check.yaml index 7f8cc94241..3417baa93b 100644 --- a/.github/workflows/validation-check.yaml +++ b/.github/workflows/validation-check.yaml @@ -10,13 +10,32 @@ jobs: if: startsWith(github.event.pull_request.base.ref, 'dev-v') || startsWith(github.event.pull_request.base.ref, 'release-v') runs-on: ubuntu-latest steps: + - name: Check for modifications in specified folders + id: check-modifications + uses: actions/github-script@v7 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + // Get the list of files modified in the PR + const files = await github.rest.pulls.listFiles({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number + }); + + // Check if any of the modified files are in the specified folders + const modifiedSpecifiedFolders = files.data.some(file => file.filename.startsWith('assets/') || file.filename.startsWith('charts/') || file.filename.startsWith('packages/')); + + return modifiedSpecifiedFolders; + - name: Check for positive reaction on bot's latest validation comment - uses: actions/github-script@v4 + if: steps.check-modifications.outputs.result == 'true' + uses: actions/github-script@v7 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | // Get comments on the PR - const comments = await github.issues.listComments({ + const comments = await github.rest.issues.listComments({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo @@ -29,7 +48,7 @@ jobs: const latestValidationComment = sortedComments.find(comment => comment.user.login === 'github-actions[bot]' && comment.body.startsWith("## Validation steps")); if (latestValidationComment) { - const reactions = await github.reactions.listForIssueComment({ + const reactions = await github.rest.reactions.listForIssueComment({ comment_id: latestValidationComment.id, owner: context.repo.owner, repo: context.repo.repo diff --git a/.github/workflows/validation-comment.yaml b/.github/workflows/validation-comment.yaml index 1316c4a30f..3c03b85097 100644 --- a/.github/workflows/validation-comment.yaml +++ b/.github/workflows/validation-comment.yaml @@ -17,11 +17,11 @@ jobs: permissions: write-all steps: - name: Make validation comment - uses: actions/github-script@v4 + uses: actions/github-script@v7 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | - github.issues.createComment({ + github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo,