github.com/gophercloud/gophercloud@v1.11.0/.github/workflows/semver-auto.yaml (about) 1 name: Add PR semver labels 2 on: 3 pull_request_target: 4 types: [opened, synchronize, reopened] 5 jobs: 6 go-apidiff: 7 runs-on: ubuntu-latest 8 steps: 9 - name: Remove the semver labels 10 uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 11 with: 12 labels: | 13 semver:patch 14 semver:minor 15 semver:major 16 semver:unknown 17 github_token: ${{ secrets.GITHUB_TOKEN }} 18 19 - uses: actions/checkout@v3 20 with: 21 fetch-depth: 0 22 ref: ${{ github.event.pull_request.head.sha }} 23 token: ${{ secrets.GITHUB_TOKEN }} 24 25 - name: Rebase the PR against origin/github.base_ref to ensure actual API compatibility 26 run: | 27 git config --global user.email "localrebase@gophercloud.io" 28 git config --global user.name "Local rebase" 29 git rebase -i origin/${{ github.base_ref }} 30 env: 31 GIT_SEQUENCE_EDITOR: '/usr/bin/true' 32 33 - name: Add semver:unknown label 34 if: failure() 35 uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf 36 with: 37 github_token: ${{ secrets.GITHUB_TOKEN }} 38 labels: semver:unknown 39 40 - uses: actions/setup-go@v4 41 with: 42 go-version: '1' 43 44 - name: Checking Go API Compatibility 45 id: go-apidiff 46 # if semver=major, this will return RC=1, so let's ignore the failure so label 47 # can be set later. We check for actual errors in the next step. 48 continue-on-error: true 49 uses: joelanford/go-apidiff@v0.7.0 50 51 # go-apidiff returns RC=1 when semver=major, which makes the workflow to return 52 # a failure. Instead let's just return a failure if go-apidiff failed to run. 53 - name: Return an error if Go API Compatibility couldn't be verified 54 if: steps.go-apidiff.outcome != 'success' && steps.go-apidiff.outputs.semver-type != 'major' 55 run: exit 1 56 57 - name: Add semver:patch label 58 if: steps.go-apidiff.outputs.semver-type == 'patch' 59 uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf 60 with: 61 github_token: ${{ secrets.GITHUB_TOKEN }} 62 labels: semver:patch 63 64 - name: Add semver:minor label 65 if: steps.go-apidiff.outputs.semver-type == 'minor' 66 uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf 67 with: 68 github_token: ${{ secrets.GITHUB_TOKEN }} 69 labels: semver:minor 70 71 - name: Add semver:major label 72 if: steps.go-apidiff.outputs.semver-type == 'major' 73 uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf 74 with: 75 github_token: ${{ secrets.GITHUB_TOKEN }} 76 labels: semver:major