ci: Add GitHub Actions Brick CI #45
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: formigas_github_actions brick CI | |
on: | |
pull_request: | |
paths: | |
- 'formigas_github_actions/**' | |
- '!formigas_github_actions/**/*.md' | |
- '!formigas_github_actions/docs/**' | |
- '.github/workflows/continuous-integration-formigas_github_actions.yaml' | |
- '.github/workflows/check-github_actions-ci-label.yaml' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
create-pr-with-changes: | |
name: Create PR with changes in test repository | |
runs-on: ubuntu-latest | |
env: | |
branch_name: "formigas_github_actions-changes-${{ github.event.pull_request.number }}" | |
steps: | |
- name: Checkout brick repository | |
uses: actions/checkout@v4 | |
with: | |
path: formigas-flutter-bricks | |
- name: Create GitHub App token | |
uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ vars.FORMIGAS_VERSION_BUMPER_APP_ID }} | |
private-key: ${{ secrets.FORMIGAS_VERSION_BUMPER_PRIVATE_KEY }} | |
owner: formigas | |
repositories: formigas_github_actions-brick-ci | |
- name: Checkout Github Actions test repository | |
uses: actions/checkout@v4 | |
with: | |
repository: formigas/formigas_github_actions-brick-ci | |
token: ${{ steps.app-token.outputs.token }} | |
path: formigas_github_actions-brick-ci | |
- name: Install Dart SDK | |
uses: dart-lang/setup-dart@v1 | |
with: | |
sdk: stable | |
- name: Install Mason CLI | |
run: dart pub global activate mason_cli | |
- name: Initialize Mason | |
run: mason init | |
- name: Add formigas_github_actions with Mason | |
run: mason add formigas_github_actions --path ./formigas-flutter-bricks/formigas_github_actions | |
- name: Make formigas_github_actions | |
run: mason make formigas_github_actions --on-conflict overwrite | |
working-directory: formigas_github_actions-brick-ci | |
- name: Create Pull Request | |
id: create-pr | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
branch: ${{ env.branch_name }} | |
delete-branch: true | |
commit-message: "Update GitHub Actions workflow for Github Actions brick PR ${{ github.event.pull_request.number }}" | |
title: "Automated PR for Github Actions brick changes" | |
body: "This PR is automatically generated by the Github Actions brick CI workflow. It will merge the changes made in the CI workflow into the main branch. Once the pipelines succeed, this PR will be automatically merged. See the [Github Actions brick PR](${{ github.event.pull_request.html_url }}) for more details." | |
base: main | |
path: formigas_github_actions-brick-ci | |
labels: automated-pr | |
draft: false | |
token: ${{ steps.app-token.outputs.token }} | |
- name: Set auto-merge for Pull Request | |
if: steps.create-pr.outputs.pull-request-operation == 'created' | |
run: gh pr merge ${{ steps.create-pr.outputs.pull-request-number }} --merge --auto | |
env: | |
GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
working-directory: formigas_github_actions-brick-ci |