fabric-testbed / fabrictestbed-extensions

Extensions for the fabric APUI/CLI.
MIT License
7 stars 12 forks source link

Improve changelog check #149

Open sajith opened 1 year ago

sajith commented 1 year ago

Consider https://github.com/fabric-testbed/fabrictestbed-extensions/pull/148: our little check for changelog updates failed on this PR.

This PR is not big enough to have a changelog, so I added the "no changelog" label, and re-ran the workflow. It ran the check, and failed again. Because, apparently, this line does not do what I thought it would do:

https://github.com/fabric-testbed/fabrictestbed-extensions/blob/0665998dbc58fa36e75d2355c78112aa532e32df/.github/workflows/checks.yml#L49

It appears that the values carried by github.event.pull_request.labels.*.name are from the time of PR creation. Adding a label later will not update that list.

There's a possibly working method to gather current labels are suggested in this StackOverflow thread:

name: Get Labels
on: [pull_request]
permissions:
  pull-requests: write
jobs:
  get-labels:
    runs-on: ubuntu-latest
    steps:
      - run: |
          labels="$(gh api repos/$OWNER/$REPO_NAME/pulls/$PULL_REQUEST_NUMBER --jq '.labels.[].name')"
          echo "$labels"
        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 }}
sajith commented 1 year ago

Also see: https://github.com/orgs/community/discussions/39062