Update generated files #45
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:3bc50a51eae54e2e768a06a6845de5da940549a4 | |
env: | |
GOPRIVATE: "" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 #v3.6.0 | |
with: | |
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@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1 | |
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"], | |
}); |