Merge pull request #8 from formigas/codemagic-ci-changes-155 #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ${{ vars.FORMIGAS_FLIK_APP_ID }} | |
private-key: ${{ secrets.FORMIGAS_APP_PRIVATE_KEY }} | |
owner: formigas | |
repositories: formigas-flutter-bricks | |
- 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'] | |
}) |