Skip to content

Commit 7dbbe17

Browse files
[Actions] Add action to bump the hash used for the unified pipeline (#7712)
Context: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions Context: https://github.com/xamarin/sdk-insertions/wiki/Unified-pipeline#github-actions Add a GitHub Actions Workflow in `.github/workflows/sdk-insertion-bump.yml` which is run when new commits are made to the `main` and `release/**` branches. The GitHub Action will get the information of the updated branch and send that commit informtaion to the xamarin/sdk-insertions repo using a client payload via [`repository_dispatch`][0]. The event with the payload is the parsed by [xamarin/sdk-insertions/.github/workflows/sdk-bump.yml][1], which updates various YAML files for the [unified insetion pipeline][2]. This allow to have the unified pipeline build the latest commits of the SDKs without a manual trigger. Co-authored-by: Peter Collins <pecolli@microsoft.com> [0]: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#repository_dispatch [1]: https://github.com/xamarin/sdk-insertions/blob/85976c35520b21cbde62a9412c8525ac2a5f4b84/.github/workflows/sdk-bump.yml [2]: https://github.com/xamarin/sdk-insertions/wiki/Unified-pipeline#requirements
1 parent 22f10b2 commit 7dbbe17

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Notify release branch change
2+
3+
on:
4+
# trigger for main and release branches.
5+
push:
6+
branches:
7+
- main
8+
- 'release/**'
9+
10+
jobs:
11+
pingRemote:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Parse commit
18+
shell: pwsh
19+
id: commit_title
20+
run: |
21+
Write-Host "Commit message is $Env:COMMIT_MESSAGE"
22+
$title = ($Env:COMMIT_MESSAGE -split '\n')[0]
23+
"COMMIT_TITLE=$title" >> $env:GITHUB_OUTPUT
24+
env:
25+
COMMIT_MESSAGE: "${{ github.event.head_commit.message }}"
26+
27+
- name: 'Update remote repository'
28+
uses: peter-evans/repository-dispatch@v2
29+
with:
30+
token: ${{ secrets.SERVICEACCOUNT_PAT }}
31+
event-type: 'sdk_insertion'
32+
repository: 'xamarin/sdk-insertions'
33+
client-payload: '{"repository": "xamarin/xamarin-android", "branch": "${{ github.ref_name }}", "commit": "${{ github.sha }}", "commit_message": "${{ steps.commit_title.outputs.COMMIT_TITLE }}"}'
34+
35+

0 commit comments

Comments
 (0)