diff --git a/.github/workflows/createNewVersion.yml b/.github/workflows/createNewVersion.yml index e0434cf267ff..3ce0f58b98f2 100644 --- a/.github/workflows/createNewVersion.yml +++ b/.github/workflows/createNewVersion.yml @@ -40,21 +40,18 @@ jobs: validateActor: runs-on: ubuntu-latest outputs: - # TODO: fix this so we check if admin is true, as well as push - # https://docs.github.com/en/rest/apps/installations?apiVersion=2022-11-28#list-repositories-accessible-to-the-user-access-token HAS_WRITE_ACCESS: ${{ contains(fromJSON('["write", "admin"]'), steps.getUserPermissions.outputs.PERMISSION) }} steps: - name: Get user permissions id: getUserPermissions - run: echo "PERMISSION=$(gh api /users/installations/"${OS_BOTIFY_INSTALLATION_ID}"/repositories | jq -r '.repositories[].permissions')" >> "$GITHUB_OUTPUT" + run: echo "PERMISSION=$(gh api /repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission | jq -r '.permission')" >> "$GITHUB_OUTPUT" env: - GITHUB_TOKEN: fixme - OS_BOTIFY_INSTALLATION_ID: ${{ secrets.OS_BOTIFY_INSTALLATION_ID }} + GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }} createNewVersion: runs-on: macos-latest needs: validateActor - # if: ${{ fromJSON(needs.validateActor.outputs.HAS_WRITE_ACCESS) }} + if: ${{ fromJSON(needs.validateActor.outputs.HAS_WRITE_ACCESS) }} outputs: NEW_VERSION: ${{ steps.bumpVersion.outputs.NEW_VERSION }}