Skip to content

Commit

Permalink
ci: add dispatch-push-event workflow (#803)
Browse files Browse the repository at this point in the history
* ci: add dispatch-push-event workflow

Signed-off-by: Keisuke Shima <[email protected]>

* fix: change APP KEY

Signed-off-by: Keisuke Shima <[email protected]>

* chore: use strategy

Signed-off-by: Keisuke Shima <[email protected]>

* chore: change trigger

Signed-off-by: Keisuke Shima <[email protected]>

* pre-commit fixes

Signed-off-by: Keisuke Shima <[email protected]>

* Update .github/workflows/dispatch-push-event.yaml

* Update .github/workflows/dispatch-push-event.yaml

* style(pre-commit): autofix

* Update .github/workflows/dispatch-push-event.yaml

---------

Signed-off-by: Keisuke Shima <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
KeisukeShima and pre-commit-ci[bot] authored Sep 8, 2023
1 parent ea4b7d3 commit 1a11017
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/dispatch-push-event.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: dispatch-push-event
on:
push:

jobs:
search-dispatch-repo:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { version: beta/v0.3.**, dispatch-repo: pilot-auto.x1.eve }
outputs:
dispatch-repo: ${{ steps.search-dispatch-repo.outputs.value }}
steps:
- name: Search dispatch repo
id: search-dispatch-repo
run: |
if [[ ${{ github.ref_name }} =~ ${{ matrix.version }} ]]; then
echo ::set-output name=value::"${{ matrix.dispatch-repo }}"
echo "Detected beta branch: ${{ github.ref_name }}"
echo "Dispatch repository: ${{ matrix.dispatch-repo }}"
fi
dispatch-push-event:
runs-on: ubuntu-latest
needs: search-dispatch-repo
if: ${{ needs.search-dispatch-repo.outputs.dispatch-repo != '' }}
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.INTERNAL_APP_ID }}
private_key: ${{ secrets.INTERNAL_PRIVATE_KEY }}

# 注意: workflow_dispatchで指定するブランチはmain固定となっているため、dispatch-repoのmainブランチにupdate-beta-branch.yamlが存在することが前提条件。
- name: Dispatch the update-beta-branch workflow
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ steps.generate-token.outputs.token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/tier4/${{ needs.search-dispatch-repo.outputs.dispatch-repo }}/actions/workflows/update-beta-branch.yaml/dispatches \
-d '{"ref":"main"}'

0 comments on commit 1a11017

Please sign in to comment.