Skip to content

CodeGenCI

CodeGenCI #30

Workflow file for this run

name: "APICodeGen"
on:
schedule:
- cron: '0 13 * * MON'
permissions:
id-token: write # aws-actions/configure-aws-credentials@v4.0.1
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 "APICodeGen@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git config pull.rebase false
- uses: aws-actions/configure-aws-credentials@v4.0.1
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']
});