From 056f0b72ff75462a6a52e0e1e5a70aa32efb47f1 Mon Sep 17 00:00:00 2001 From: Rory Conlin Date: Tue, 12 Nov 2024 11:19:51 -0500 Subject: [PATCH 1/6] Add action for checking changelog updates --- .github/workflows/changelog_update.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/changelog_update.yml diff --git a/.github/workflows/changelog_update.yml b/.github/workflows/changelog_update.yml new file mode 100644 index 0000000000..41ca2f9043 --- /dev/null +++ b/.github/workflows/changelog_update.yml @@ -0,0 +1,19 @@ +name: Check changelog updated + +on: + pull_request: + branches: + - master + workflow_dispatch: + +jobs: + check_changelog_updated: + if: ${{contains(github.event.pull_request.labels.*.name, 'skip_changelog') == false}} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: danieljimeneznz/ensure-files-changed@v4.1.0 + with: + require-changes-to: | + CHANGELOG.md + token: ${{ secrets.GITHUB_TOKEN }} From 5ed344adb82808264fb8e81c35b827e35456977c Mon Sep 17 00:00:00 2001 From: Rory Conlin Date: Tue, 12 Nov 2024 11:27:28 -0500 Subject: [PATCH 2/6] Fix if syntax --- .github/workflows/changelog_update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/changelog_update.yml b/.github/workflows/changelog_update.yml index 41ca2f9043..5c34f14594 100644 --- a/.github/workflows/changelog_update.yml +++ b/.github/workflows/changelog_update.yml @@ -8,7 +8,7 @@ on: jobs: check_changelog_updated: - if: ${{contains(github.event.pull_request.labels.*.name, 'skip_changelog') == false}} + if: contains(github.event.pull_request.labels.*.name, 'skip_changelog') == false runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 57f94f329de817e467224033c5e0ee5db6c2c833 Mon Sep 17 00:00:00 2001 From: Rory Conlin Date: Tue, 12 Nov 2024 11:50:11 -0500 Subject: [PATCH 3/6] Fix getting labels --- .github/workflows/changelog_update.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/changelog_update.yml b/.github/workflows/changelog_update.yml index 5c34f14594..0fc547767a 100644 --- a/.github/workflows/changelog_update.yml +++ b/.github/workflows/changelog_update.yml @@ -7,9 +7,26 @@ on: workflow_dispatch: jobs: + get_labels: + runs-on: ubuntu-latest + outputs: + labels: ${{ steps.step1.outputs.labels }} + steps: + - id: step1 + run: | + labels="$(gh api repos/$OWNER/$REPO_NAME/pulls/$PULL_REQUEST_NUMBER --jq '.labels.[].name')" + echo "$labels" + echo "$labels" >> "$GITHUB_OUTPUT" + shell: bash + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OWNER: ${{ github.repository_owner }} + REPO_NAME: ${{ github.event.repository.name }} + PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} check_changelog_updated: - if: contains(github.event.pull_request.labels.*.name, 'skip_changelog') == false runs-on: ubuntu-latest + needs: get_labels + if: contains(${{needs.get_labels.outputs.labels}}, 'skip_changelog') == false steps: - uses: actions/checkout@v4 - uses: danieljimeneznz/ensure-files-changed@v4.1.0 From 9906f9ef151d98066daec4502498e243ca3ea861 Mon Sep 17 00:00:00 2001 From: Rory Conlin Date: Tue, 12 Nov 2024 11:57:50 -0500 Subject: [PATCH 4/6] Trying again --- .github/workflows/changelog_update.yml | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/.github/workflows/changelog_update.yml b/.github/workflows/changelog_update.yml index 0fc547767a..0e3f883d78 100644 --- a/.github/workflows/changelog_update.yml +++ b/.github/workflows/changelog_update.yml @@ -4,29 +4,12 @@ on: pull_request: branches: - master - workflow_dispatch: + types: [opened, synchronize, labeled, unlabeled] jobs: - get_labels: - runs-on: ubuntu-latest - outputs: - labels: ${{ steps.step1.outputs.labels }} - steps: - - id: step1 - run: | - labels="$(gh api repos/$OWNER/$REPO_NAME/pulls/$PULL_REQUEST_NUMBER --jq '.labels.[].name')" - echo "$labels" - echo "$labels" >> "$GITHUB_OUTPUT" - shell: bash - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - OWNER: ${{ github.repository_owner }} - REPO_NAME: ${{ github.event.repository.name }} - PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} check_changelog_updated: + if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip_changelog') }} runs-on: ubuntu-latest - needs: get_labels - if: contains(${{needs.get_labels.outputs.labels}}, 'skip_changelog') == false steps: - uses: actions/checkout@v4 - uses: danieljimeneznz/ensure-files-changed@v4.1.0 From 318033b3aec2d82eeb34842338f348eb1badf7e0 Mon Sep 17 00:00:00 2001 From: Rory Conlin Date: Tue, 12 Nov 2024 12:06:38 -0500 Subject: [PATCH 5/6] Refactor to only skip step not whole job --- .github/workflows/changelog_update.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/changelog_update.yml b/.github/workflows/changelog_update.yml index 0e3f883d78..e5ca165dfc 100644 --- a/.github/workflows/changelog_update.yml +++ b/.github/workflows/changelog_update.yml @@ -8,11 +8,11 @@ on: jobs: check_changelog_updated: - if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip_changelog') }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: danieljimeneznz/ensure-files-changed@v4.1.0 + - if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip_changelog') }} + uses: danieljimeneznz/ensure-files-changed@v4.1.0 with: require-changes-to: | CHANGELOG.md From e6177b60e130957be34db0716f8045c4be378b84 Mon Sep 17 00:00:00 2001 From: Rory Conlin Date: Wed, 13 Nov 2024 12:51:36 -0500 Subject: [PATCH 6/6] Add filter --- .github/workflows/changelog_update.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/changelog_update.yml b/.github/workflows/changelog_update.yml index e5ca165dfc..c3b1691be6 100644 --- a/.github/workflows/changelog_update.yml +++ b/.github/workflows/changelog_update.yml @@ -10,8 +10,24 @@ jobs: check_changelog_updated: runs-on: ubuntu-latest steps: + - name: Filter changes + id: changes + uses: dorny/paths-filter@v3 + with: + filters: | + has_changes: + - 'desc/**' + - 'requirements.txt' + - 'requirements_conda.yml' + - '.github/workflows/changelog_update.yml' + + - name: Check for relevant changes + id: check_changes + run: echo "has_changes=${{ steps.changes.outputs.has_changes }}" >> $GITHUB_ENV + - uses: actions/checkout@v4 - - if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip_changelog') }} + + - if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip_changelog') && env.has_changes == 'true'}} uses: danieljimeneznz/ensure-files-changed@v4.1.0 with: require-changes-to: |