Skip to content

Commit

Permalink
modular action workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kasey committed Jan 7, 2025
1 parent 40e6376 commit ee79b82
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 42 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build-unclog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: build-unclog

on:
workflow_call:
inputs:
binary-name:
required: true
type: string

jobs:
build-unclog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'

- name: Build
run: go build -o unclog -v .

- name: Upload changelog binary
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.binary-name }}
path: unclog
45 changes: 3 additions & 42 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,6 @@ on:

jobs:
build-changelog-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'

- name: Build
run: go build -o unclog -v .

- name: Upload changelog binary
uses: actions/upload-artifact@v3
with:
name: unclog-binary
path: unclog

run-changelog-check:
runs-on: ubuntu-latest
needs: build-changelog-check

steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Download changelog check binary
uses: actions/download-artifact@v3
with:
name: unclog-binary

- name: Get new changelog files
id: new-changelog-files
uses: tj-actions/changed-files@v45
with:
files: |
log/**.md
- name: Run lint command
env:
ALL_ADDED_MARKDOWN: ${{ steps.new-changelog-files.outputs.added_files }}
run: chmod +x unclog && ./unclog check -fragment-env=ALL_ADDED_MARKDOWN
uses: .github/workflows/build-unclog.yml
with:
binary-name: unclog
39 changes: 39 additions & 0 deletions .github/workflows/changelog_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: dogfood

on:
pull_request:
- branches: [ "main" ]

jobs:
build-changelog-check:
uses: .github/workflows/build-unclog.yml
with:
binary-name: unclog-${{ github.ref_name }}

run-changelog-check:
runs-on: ubuntu-latest
needs: build-changelog-check

steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Download changelog check binary
uses: actions/download-artifact@v3
with:
name: unclog-${{ github.ref_name }}

- name: Get new changelog files
id: new-changelog-files
uses: tj-actions/changed-files@v45
with:
files: |
log/**.md
- name: Run lint command
env:
ALL_ADDED_MARKDOWN: ${{ steps.new-changelog-files.outputs.added_files }}
run: chmod +x unclog && ./unclog check -fragment-env=ALL_ADDED_MARKDOWN

0 comments on commit ee79b82

Please sign in to comment.