Skip to content

Commit 2fed764

Browse files
authored
Add Artikodin workflow (#2)
This allows to add support for Artikodin Code Freeze in all the repositories without having to individually add the workflows in each repository.
1 parent 2dcbc76 commit 2fed764

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/artikodin.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Artikodin pull-request handler
2+
3+
4+
on:
5+
# Runs on a pull request for the main branch
6+
pull_request:
7+
types:
8+
# Default events
9+
- opened
10+
- synchronize
11+
- reopened
12+
# But we also want to make sure a potential
13+
# exception request pull request is getting
14+
# closed if any was open
15+
- closed
16+
branch:
17+
- main
18+
19+
# Runs on a merge group build
20+
merge_group:
21+
types:
22+
- checks_requested
23+
24+
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
27+
cancel-in-progress: false
28+
29+
jobs:
30+
handle:
31+
name: Run Artikodin handler
32+
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- name: Getting an app token if Artikodin is available
37+
env:
38+
ARTIKODIN_CONTROLLER_APP_ID: ${{ secrets.ARTIKODIN_CONTROLLER_APP_ID }}
39+
ARTIKODIN_CONTROLLER_PRIVATE_KEY: ${{ secrets.ARTIKODIN_CONTROLLER_PRIVATE_KEY }}
40+
ARTIKODIN_CONTENTS_APP_ID: ${{ secrets.ARTIKODIN_CONTENTS_APP_ID }}
41+
ARTIKODIN_CONTENTS_PRIVATE_KEY: ${{ secrets.ARTIKODIN_CONTENTS_PRIVATE_KEY }}
42+
if: ${{ env.ARTIKODIN_CONTROLLER_APP_ID != '' && env.ARTIKODIN_CONTROLLER_PRIVATE_KEY != '' && env.ARTIKODIN_CONTENTS_APP_ID != '' && env.ARTIKODIN_CONTENTS_PRIVATE_KEY != '' }}
43+
uses: actions/create-github-app-token@v1
44+
id: app-token
45+
with:
46+
app-id: ${{ secrets.ARTIKODIN_CONTENTS_APP_ID }}
47+
private-key: ${{ secrets.ARTIKODIN_CONTENTS_PRIVATE_KEY }}
48+
owner: temporalio
49+
repositories: artikodin
50+
51+
- name: Checkout Artikodin
52+
if: ${{ steps.app-token.outputs.token != '' }}
53+
uses: actions/checkout@v4
54+
with:
55+
repository: temporalio/artikodin
56+
ref: main
57+
token: ${{ steps.app-token.outputs.token }}
58+
persist-credentials: false
59+
60+
- name: Synchronize authorization
61+
if: ${{ steps.app-token.outputs.token != '' }}
62+
uses: ./request
63+
with:
64+
skip-checkout: true
65+
contents-app-id: ${{ secrets.ARTIKODIN_CONTENTS_APP_ID }}
66+
contents-private-key: ${{ secrets.ARTIKODIN_CONTENTS_PRIVATE_KEY }}
67+
controller-app-id: ${{ secrets.ARTIKODIN_CONTROLLER_APP_ID }}
68+
controller-private-key: ${{ secrets.ARTIKODIN_CONTROLLER_PRIVATE_KEY }}
69+
target-repository: "${{ github.repository }}"
70+
target-pull-request: "${{ github.event.pull_request.number }}"
71+
target-merge-group-head-ref: "${{ github.event.merge_group.head_ref }}"
72+
target-git-sha: "${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}"
73+
closing-pr: ${{ github.event.action == 'closed' }}

0 commit comments

Comments
 (0)