-
Notifications
You must be signed in to change notification settings - Fork 319
56 lines (52 loc) · 1.79 KB
/
ci-generate-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: CI Generate CI
on:
push:
branches:
- 'dev-gh-*' # trigger workflow on dev branches
pull_request:
paths:
- ".github/workflows-source/*.yml"
- ".github/workflows/*.yml" # trigger workflow on both to ensure they are in sync
env:
CI_PROJECT_DIR: ${{ github.workspace }}
jobs:
generate-ci:
name: Generate CI
runs-on: ubuntu-latest
steps:
- name: Create GitHub App Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }}
private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v4
# If this is a pull request, use the HEAD ref instead of the merge commit
if: github.event_name == 'pull_request'
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ steps.app-token.outputs.token }}
- name: Checkout
uses: actions/checkout@v4
if: github.event_name != 'pull_request'
with:
token: ${{ steps.app-token.outputs.token }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Run Generate CI
id: generate-ci
run: |
python $CI_PROJECT_DIR/.github/scripts/generate-ci.py
if [ -n "$(git status --porcelain)" ]; then
git config --global user.name "IDX GitHub Automation"
git config --global user.email "IDX GitHub Automation"
git add .
git commit -m "IDX GitHub Automation"
git push
else
echo "git working tree clean - no changes to be committed"
fi