Skip to content

Commit

Permalink
CI: add go-apidiff check
Browse files Browse the repository at this point in the history
Signed-off-by: Lorenz Bauer <[email protected]>
  • Loading branch information
lmb committed Nov 17, 2023
1 parent e1bf3cc commit dbb989c
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/apidiff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: apidiff
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
go-apidiff:
name: go-apidiff
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- uses: joelanford/go-apidiff@main
38 changes: 38 additions & 0 deletions .github/workflows/trusted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
on:
workflow_run:
workflows: ["apidiff"]
types:
- completed

permissions:
issues: write

jobs:
tag-breaking-change:
name: Tag breaking changes
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'failure'
steps:
- name: Get PR ID
id: pr_id
run: |
PR_ID=$(gh pr view -R "${{ github.repository }}" "${{ github.event.workflow_run.head_repository.owner.login }}:${{ github.event.workflow_run.head_branch }}" --json "number" --jq ".number")
echo "pr_id=${PR_ID}" >> $GITHUB_OUTPUT
# - name: Output PR ID
# id: pr-id
# run: |
# echo "${{ steps.pr_id.outputs.pr_id }}"
- name: Add breaking-change label
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue_number = ${{ steps.pr_id.outputs.pr_id }};
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
labels: ['breaking-change']
});

0 comments on commit dbb989c

Please sign in to comment.