Merge pull request #1862 from YunoHost/cleanup_workflows

Simplify github workflows
This commit is contained in:
Salamandar 2024-06-02 20:40:10 +02:00 committed by GitHub
commit 064fa32a39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 25 deletions

View file

@ -1,29 +1,24 @@
name: Check / auto apply Black
on:
push:
branches:
- dev
branches: [ "dev" ]
jobs:
black:
name: Check / auto apply black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check files using the black formatter
uses: psf/black@stable
id: black
with:
options: "."
continue-on-error: true
- shell: pwsh
id: check_files_changed
run: |
# Diff HEAD with the previous commit
$diff = git diff
$HasDiff = $diff.Length -gt 0
Write-Host "::set-output name=files_changed::$HasDiff"
- name: Create Pull Request
if: steps.check_files_changed.outputs.files_changed == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}

View file

@ -12,28 +12,18 @@ jobs:
steps:
- name: Fetch the source code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
id: run_updater
run: |
# Setting up Git user
git config --global user.name 'yunohost-bot'
git config --global user.email 'yunohost-bot@users.noreply.github.com'
# Download n
wget https://raw.githubusercontent.com/tj/n/master/bin/n --output-document=helpers/vendor/n/n
# Proceed only if there is a change
[[ -z "$(git diff helpers/vendor/n/n)" ]] || echo "PROCEED=true" >> $GITHUB_ENV
echo "VERSION=$(sed -n 's/^VERSION=\"\(.*\)\"/\1/p' < n)" >> $GITHUB_ENV
- name: Commit changes
id: commit
if: ${{ env.PROCEED == 'true' }}
run: |
git commit -am "Upgrade n to v$VERSION"
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v6
id: cpr
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update n to ${{ env.VERSION }}
@ -41,7 +31,7 @@ jobs:
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
base: dev
branch: ci-auto-update-n-v${{ env.VERSION }}
branch: ci-auto-update-n-${{ env.VERSION }}
delete-branch: true
title: 'Upgrade n to ${{ env.VERSION }}'
body: |