Skip to content

Commit

Permalink
ci: Add workflow to update PR labels on successful CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Peetee06 committed Sep 19, 2024
1 parent d8af52c commit ca6a436
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/update-codemagic-brick-PR-label.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Update Codemagic Brick PR label in formigas-flutter-bricks

on:
push:
branches:
- main

jobs:
update_pr_label:
if: startsWith(github.event.head_commit.message, 'Merge pull request') && contains(github.event.head_commit.message, 'from formigas/codemagic-ci-changes-')
runs-on: ubuntu-latest
steps:
- name: Extract PR number
id: extract_pr
run: |
PR_NUMBER=$(echo "${{ github.event.head_commit.message }}" | grep -oP 'from formigas/codemagic-ci-changes-\K\d+')
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.FORMIGAS_APP_ID }}
private-key: ${{ secrets.FORMIGAS_APP_PRIVATE_KEY }}

- name: Add label to PR
uses: actions/github-script@v7
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
github.rest.issues.addLabels({
owner: 'formigas',
repo: 'formigas-flutter-bricks',
issue_number: ${{ steps.extract_pr.outputs.pr_number }},
labels: ['codemagic-ci: success']
})

0 comments on commit ca6a436

Please sign in to comment.