Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: sync files with stordco/common-config-elixir #85

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 49 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,48 @@ concurrency:
cancel-in-progress: true

jobs:
Changed:
name: Changed Files
runs-on: ubuntu-latest

outputs:
database: ${{ steps.changed.outputs.database_any_changed }}
docker: ${{ steps.changed.outputs.docker_any_changed }}
elixir: ${{ steps.changed.outputs.elixir_any_changed }}
helm: ${{ steps.changed.outputs.helm_any_changed }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2

- id: changed
name: Get Changed Files
uses: tj-actions/changed-files@v42
with:
files_yaml: |
database:
- '.github/workflows/ci.yaml'
- 'priv/*repo/**'
docker:
- '.github/workflows/ci.yaml'
- 'Dockerfile'
elixir:
- '.github/workflows/ci.yaml'
- 'priv/**'
- '**.ex'
- '**.exs'
- '**.heex'
helm:
- '.github/workflows/ci.yaml'
- '.github/workflows/staging.yaml'
- '.github/workflows/production.yaml'
- 'helm/**'

Credo:
if: ${{ !startsWith(github.head_ref, 'release-please--branches') }}
if: ${{ !startsWith(github.head_ref, 'release-please--branches') && needs.Changed.outputs.elixir == 'true' }}
needs: [Changed]
runs-on: ubuntu-latest

steps:
Expand All @@ -48,7 +88,8 @@ jobs:
run: mix credo --strict

Dependencies:
if: ${{ !startsWith(github.head_ref, 'release-please--branches') }}
if: ${{ !startsWith(github.head_ref, 'release-please--branches') && needs.Changed.outputs.elixir == 'true' }}
needs: [Changed]
runs-on: ubuntu-latest

steps:
Expand All @@ -67,7 +108,8 @@ jobs:
run: mix deps.unlock --check-unused

Dialyzer:
if: ${{ !startsWith(github.head_ref, 'release-please--branches') }}
if: ${{ !startsWith(github.head_ref, 'release-please--branches') && needs.Changed.outputs.elixir == 'true' }}
needs: [Changed]
runs-on: ubuntu-latest

steps:
Expand All @@ -86,7 +128,8 @@ jobs:
run: mix dialyzer --format github

Documentation:
if: ${{ !startsWith(github.head_ref, 'release-please--branches') }}
if: ${{ !startsWith(github.head_ref, 'release-please--branches') && needs.Changed.outputs.elixir == 'true' }}
needs: [Changed]
runs-on: ubuntu-latest

steps:
Expand All @@ -105,7 +148,8 @@ jobs:
run: mix docs

Format:
if: ${{ !startsWith(github.head_ref, 'release-please--branches') }}
if: ${{ !startsWith(github.head_ref, 'release-please--branches') && needs.Changed.outputs.elixir == 'true' }}
needs: [Changed]
runs-on: ubuntu-latest

steps:
Expand Down
34 changes: 25 additions & 9 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,31 @@ jobs:

steps:
- name: Check
uses: stordco/actions-pr-title@v1.0.0
uses: actions/github-script@v7
with:
regex: '^(feat!|fix!|fix|feat|chore|(fix|feat|chore)\(\w.*\)):\s(\[\w{1,8}-\d{1,8}\]|.*).*'
hint: |
Your PR title does not match the Stord common convention. Please rename your PR to match one of the following formats:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const title = context.payload?.pull_request?.title;

chore: a small insignificant change
fix: [JIRA-1234] fix an existing feature
feat: [JIRA-1234] a new feature to release
feat!: a breaking change
if (typeof title !== 'string') {
core.info("Pull request data not in payload. Skipping PR title check.");
return;
}

Note: Adding ! (i.e. `feat!:`) represents a breaking change and will result in a SemVer major release.
const REGEX = /^(feat!|fix!|fix|feat|chore|(fix|feat|chore)\(\w.*\)):\s(\[\w{1,8}-\d{1,8}\]|.*).*/;

if (!REGEX.test(title)) {
core.setFailed("Pull request title does not follow conventional commits");
console.log(`
Pull Request title "${title}" does not follow our [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) naming scheme.

Please try renaming the PR to match one of these examples:

chore: a small insignificant change
fix: [JIRA-1234] fix an existing feature
feat: [JIRA-1234] a new feature to release
feat!: a breaking change

Note: Adding ! (i.e. \`feat!:\`) represents a breaking change and will result in a SemVer major release.
`.trim());
}
Loading