-
Notifications
You must be signed in to change notification settings - Fork 960
53 lines (53 loc) · 2.09 KB
/
codegen.yaml
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
name: "APICodeGen"
on:
schedule:
- cron: '0 13 * * MON'
permissions:
id-token: write # aws-actions/[email protected]
pull-requests: write # name: Create Pull Request
contents: write # name: Create Pull Request
jobs:
codegen:
if: github.repository == 'aws/karpenter'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-deps
- run: |
git config user.name "APICodeGen"
git config user.email "[email protected]"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git config pull.rebase false
- uses: aws-actions/[email protected]
with:
role-to-assume: 'arn:aws:iam::${{ vars.ECR_ACCOUNT_ID }}:role/${{ vars.ECR_SNAPSHOT_ROLE_NAME }}'
aws-region: ${{ vars.ECR_REGION }}
- run: make codegen
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_GIT_PUSH: true
- id: detect-changes
run: cat /tmp/codegen-updates && echo APICodeGenUpdate=true >> "$GITHUB_OUTPUT"
- name: Create Pull Request
if: steps.detect-changes.outputs.APICodeGenUpdate == 'true'
uses: actions/github-script@v6
with:
script: |
const { repo, owner } = context.repo;
const result = await github.rest.pulls.create({
title: 'chore: Update data from AWS APIs',
owner,
repo,
head: 'codegen',
base: 'main',
body: [
'Updates auto generated files with data from the AWS APIs for pricing and VPC limits. Please remove the branch after merging.',
'This PR is generated by [APICodeGen](https://github.com/aws/karpenter/actions/workflows/codegen.yml).'
].join('\n')
});
github.rest.issues.addLabels({
owner,
repo,
issue_number: result.data.number,
labels: ['aws', 'dependencies']
});