Skip to content

Commit

Permalink
[FEATURE] Ajoute une action pour vérifier les titres des PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
pix-service-auto-merge authored Mar 11, 2024
2 parents 337449e + aec5664 commit 225e857
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 22 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/check-pr-title-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Check PR title

on:
pull_request:
types: [opened, edited, ready_for_review, reopened]

jobs:
lint-pr-title:
runs-on: ubuntu-latest
steps:
- uses: 1024pix/pix-actions/check-pr-title@main
4 changes: 2 additions & 2 deletions .github/workflows/release-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
repository_dispatch:
types: [ 'deploy' ]
types: ['deploy']
workflow_dispatch:

jobs:
Expand All @@ -18,4 +18,4 @@ jobs:
with:
updateMajorVersion: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52 changes: 40 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# pix-actions

Centralisations des GitHub Actions de Pix

## auto-merge

Chez Pix, nous aimons les labels GitHub. Après notre process de review et quand une PR est prête à être mergée, nous ajoutons le label :

> `:rocket: Ready to merge` :rocket:
L'ajout de ce label permet de démarrer l'action GitHub d'`auto-merge` qui va se débrouiller pour rebase la branche de la PR et la merger si toutes les validations automatisées (tests auto...) sont au vert.

### Utilisation

:warning: WIP, la version `v1` n'est pas encore disponible.
La liste des triggers permettant de déclencher l'action est à rediscuter.

Expand Down Expand Up @@ -38,9 +41,9 @@ jobs:
steps:
- uses: 1024pix/pix-actions/auto-merge@v0
with:
auto_merge_token: "${{ secrets.PIX_SERVICE_ACTIONS_TOKEN }}"

auto_merge_token: '${{ secrets.PIX_SERVICE_ACTIONS_TOKEN }}'
```
</details>
## check-node-version-availability
Expand Down Expand Up @@ -72,11 +75,12 @@ jobs:
- uses: 1024pix/pix-actions/check-node-version-availability-on-scalingo@v0
```

</details>

## Release

Pour simplifier le déploiement continue de nos applications, nous utilisons l'action `release` qui permet de créer
Pour simplifier le déploiement continue de nos applications, nous utilisons l'action `release` qui permet de créer
la bonne version, de générer le changelog et de la publier sur GitHub et npm si besoin.

### Utilisation
Expand All @@ -92,7 +96,7 @@ on:
branches:
- main
repository_dispatch:
types: [ 'deploy' ]
types: ['deploy']
workflow_dispatch:
jobs:
Expand All @@ -102,14 +106,13 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: 1024pix/pix-actions/release@main
env:
GITHUB_TOKEN: ${{ env.GH_TOKEN }} # Use PAT with repo scope, and user related should have admin access if main branch is protected
```


### Configuration
### Configuration

#### `npmPublish` (optionnel)

Expand All @@ -134,7 +137,7 @@ jobs:
- run: npm ci
- run: npm run build
- uses: 1024pix/pix-actions/release@main
with:
npmPublish: true
Expand All @@ -143,10 +146,9 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```


#### `updateMajorVersion` (optionnel)

Permet de mettre à jour le tag git majeur exemple : `v1`. Utiliser pour nos pix-actions
Permet de mettre à jour le tag git majeur exemple : `v1`. Utiliser pour nos pix-actions

Valeur par défault : `false`

Expand All @@ -158,11 +160,37 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: 1024pix/pix-actions/release@main
with:
with:
updateMajorVersion: true
env:
GITHUB_TOKEN: ${{ env.GH_TOKEN }} # Use PAT with repo scope, and user related should have admin access if main branch is protected
```

</details>

## Check PR title

En complément de l'action de `release`, vérifier le format des titres de PRs.

Les noms acceptés qui sont utilisables par `semantic-release` sont listés ici : https://github.com/1024pix/conventional-changelog-pix/blob/main/src/writerOpts.js.

### Utilisation

<details>
<summary><code>.github/workflows/check-pr-title.yml</code></summary>

```yaml
name: Check PR title
on:
pull_request:
types: [opened, edited, ready_for_review, reopened]
jobs:
lint-pr-title:
runs-on: ubuntu-latest
steps:
- uses: 1024pix/pix-actions/check-pr-title@main
```
8 changes: 4 additions & 4 deletions auto-merge/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ inputs:
merge_labels:
type: string
default: ':rocket: Ready to Merge,!:warning: Blocked,!:earth_africa: i18n needed,!:busts_in_silhouette: Panel Review Needed,!Development in progress,!:eyes: Design Review Needed,!:eyes: Func Review Needed,!:eyes: Tech Review Needed'
merge_commit_message:
merge_commit_message:
type: string
default: "{pullRequest.title} \n\n #{pullRequest.number}"
update_labels:
update_labels:
type: string
default: ':rocket: Ready to Merge'
update_method:
update_method:
type: string
default: rebase
merge_forks:
merge_forks:
type: string
default: 'false'

Expand Down
2 changes: 1 addition & 1 deletion check-node-version-availability-on-scalingo/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ runs:
using: composite
steps:
- run: ${{ github.action_path }}/check-node-version-availability-on-scalingo.sh ${{ inputs.directory }}
shell: bash
shell: bash
15 changes: 15 additions & 0 deletions check-pr-title/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Check PR title
description: >-
This workflow will check PR title, accepted tags are listed in
https://github.com/1024pix/conventional-changelog-pix/blob/main/src/writerOpts.js
os: ubuntu-latest

runs:
using: composite
steps:
- name: lint-pr-title
if: github.event.pull_request.draft == false && github.event.pull_request.state == 'open'
uses: Slashgear/[email protected]
with:
regexp: '^(\[[A-Z]+\]|Revert) '
6 changes: 3 additions & 3 deletions release/action.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Generate Changelog and Release
description: >-
This workflow will generate a changelog and release a new version of the
project.
This workflow will generate a changelog and release a new version of the
project.
os: ubuntu-latest

Expand Down Expand Up @@ -43,7 +43,7 @@ runs:

- name: share variables
if: steps.semantic.outputs.new_release_published == 'true'
run: |
run: |
echo "new_release_published=${{ steps.semantic.outputs.new_release_published }}" >> $GITHUB_ENV
echo "new_release_version=${{ steps.semantic.outputs.new_release_version }}" >> $GITHUB_ENV
echo "new_release_major_version=${{ steps.semantic.outputs.new_release_major_version }}" >> $GITHUB_ENV
Expand Down

0 comments on commit 225e857

Please sign in to comment.