Update generated files #180
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update generated files | |
on: | |
workflow_dispatch: {} | |
schedule: | |
- cron: "0 5 * * Thu" | |
env: | |
DEFAULT_BRANCH: main | |
UPDATE_BRANCH: update-aws-node | |
jobs: | |
update_aws_node: | |
name: Update aws-node and open PR | |
runs-on: ubuntu-latest | |
container: public.ecr.aws/eksctl/eksctl-build:516ded83aa5dbd3e3c4e25c5d410e2dba3b5e668 | |
env: | |
GOPRIVATE: "" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 #v4.1.0 | |
with: | |
token: ${{ secrets.EKSCTLBOT_TOKEN }} | |
fetch-depth: 0 | |
- name: Setup identity as eksctl-bot | |
uses: ./.github/actions/setup-identity | |
with: | |
token: "${{ secrets.EKSCTLBOT_TOKEN }}" | |
- name: Cache go-build and mod | |
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2 | |
with: | |
path: | | |
~/.cache/go-build/ | |
~/go/pkg/mod/ | |
key: go-${{ hashFiles('go.sum') }} | |
restore-keys: | | |
go- | |
- name: Update aws-node | |
run: make update-aws-node | |
- name: Commit changes | |
id: commit | |
run: | | |
git checkout $DEFAULT_BRANCH | |
git checkout -B $UPDATE_BRANCH | |
git add -u | |
if ! EDITOR=true git commit -m "Update aws-node"; then | |
echo "changes=false" >> $GITHUB_OUTPUT | |
exit 0 | |
fi | |
echo "changes=true" >> $GITHUB_OUTPUT | |
! git diff --exit-code $DEFAULT_BRANCH HEAD | |
git push --force-with-lease origin HEAD | |
- uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 #v6.4.1 | |
name: Open PR to ${{env.DEFAULT_BRANCH}} | |
if: steps.commit.outputs.changes == 'true' | |
with: | |
github-token: ${{ secrets.EKSCTLBOT_TOKEN }} | |
script: | | |
const { data: pr } = await github.rest.pulls.create({ | |
...context.repo, | |
title: "Update aws-node", | |
head: "${{ env.UPDATE_BRANCH }}", | |
base: "${{ env.DEFAULT_BRANCH }}", | |
}); | |
await github.rest.issues.addLabels({ | |
...context.repo, | |
issue_number: pr.number, | |
labels: ["kind/improvement"], | |
}); |