Skip to content

Commit

Permalink
Merge pull request #454 from freifunkMUC/backport-452-to-next
Browse files Browse the repository at this point in the history
[Backport next] Add workflow to automatically update targets file
  • Loading branch information
grische authored Jul 4, 2024
2 parents 96714ea + b7a2a10 commit 46c9ccb
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/update-targets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
name: "Update Targets"

on:
workflow_dispatch:
push:
branches:
- stable
- legacy
- next
paths:
- 'Makefile'

permissions:
contents: write # so it can comment
pull-requests: write # so it can create pull requests

jobs:
update-Modules:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get update branch name
id: branch-name
run: echo "branch-name=update-targets-${{ github.ref_name }}" >> $GITHUB_OUTPUT

- name: Run update-targets
run: make update-targets

- name: Get new targets
id: new-targets
run:
echo "names=$(git diff --color=always|perl -wlne 'print $1 if /^\e\[32m\+\e\[m\e\[32m(.*)\e\[m$/' | tr '\n' ' ')" >> $GITHUB_OUTPUT

- name: Create Pull Request
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
with:
title: '[${{ github.ref_name }}] Add targets ${{ steps.new-targets.outputs.names }}'
body: |
Updated targets for branch ${{ github.ref_name }}
New targets: `${{ steps.new-targets.outputs.names }}`
⚠️ Please trigger the CI before merging this pull request. ⚠️
commit-message: "targets: add ${{ steps.new-targets.outputs.names }}"
branch: ${{ steps.branch-name.outputs.branch-name }}
labels: ${{ github.ref_name }}
draft: true # this step does not trigger a CI run, so always mark them as draft
delete-branch: true
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,7 @@ output-clean:
rm -rf output/*

clean: gluon-clean output-clean

update-targets: gluon-update gluon-patch
ls -1 ${GLUON_BUILD_DIR}/targets/ | grep -v "\.inc" | grep -v "\.mk" | grep -v '^generic$$' > targets
git diff targets

0 comments on commit 46c9ccb

Please sign in to comment.