Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commit autogenerated files directly to PR head ref #957

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
70 changes: 0 additions & 70 deletions .github/actions/finalize/action.yml

This file was deleted.

45 changes: 29 additions & 16 deletions .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ runs:
then
echo "result=true" >> $GITHUB_OUTPUT
else
# TODO: set back to false to avoid always building
echo "result=true" >> $GITHUB_OUTPUT
fi

Expand All @@ -44,26 +45,40 @@ runs:
- name: Generate dockerfiles
if: steps.should_publish.outputs.result == 'true'
shell: bash
run: npm run all
run: npm run all >/dev/null

- name: Generate docs
if: steps.should_publish.outputs.result == 'true'
shell: bash
run: npm run all-dockerhub
run: npm run all-dockerhub >/dev/null

- name: Generate bakefiles
if: steps.should_publish.outputs.result == 'true'
shell: bash
run: npm run all-lib
run: npm run all-lib >/dev/null

- name: Generate workflows
if: steps.should_publish.outputs.result == 'true'
shell: bash
run: npm run all-workflows
run: npm run all-workflows >/dev/null

- name: Commit and create patch
# We need a token with contents:write and workflows:write permissions
# so the automatic GITHUB_TOKEN won't work
# https://github.com/tibdex/github-app-token
- name: Generate GitHub App installation token
if: steps.should_publish.outputs.result == 'true'
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
id: gh_app_token
with:
app_id: "400994"
installation_retrieval_mode: organization
installation_retrieval_payload: ${{ github.event.repository.owner.login }}
private_key: ${{ fromJSON(inputs.secrets).BALENALIB_BOT_PRIVATE_KEY }}
repositories: >
["${{ github.event.repository.name }}"]

- name: Commit and push
if: steps.should_publish.outputs.result == 'true'
continue-on-error: true
shell: bash
env:
# get the user id of the GitHub App
Expand All @@ -73,15 +88,13 @@ runs:
GIT_COMMITTER_NAME: balenalib-workflows[bot]
GIT_COMMITTER_EMAIL: 146760701+balenalib-workflows[bot]@users.noreply.github.com
run: |
if [ -z "$(git status --porcelain)" ]
then
echo "No changes to commit"
exit 0
fi
git config --local --unset-all http.https://github.com/.extraheader
git add -A balena-base-images library .github/workflows
git commit -m "Autogenerated libraries" -m "[skip ci]"
git format-patch -k -s HEAD^ -o ${{ runner.temp }}/patches

# https://github.com/actions/upload-artifact
- name: Upload patches artifact
if: steps.should_publish.outputs.result == 'true'
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: patches-${{ github.event.pull_request.head.sha }}
path: ${{ runner.temp }}/patches
retention-days: 90
git remote set-url origin https://x-access-token:${{ steps.gh_app_token.outputs.token }}@github.com/$GITHUB_REPOSITORY
git push origin HEAD:${{ github.head_ref }}
9 changes: 7 additions & 2 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@
"**/tests//**",
"**/__fixtures__/**",
"balena-base-images/**",
"library/**",
"library/**",
".github/workflows/bake-*.yml"
],
"github-actions": {
"fileMatch": ["^scripts/workflows/.*\\.yml"]
}
},
"gitIgnoredAuthors": [
"[email protected]",
"[email protected]",
"146760701+balenalib-workflows[bot]@users.noreply.github.com"
]
}
2 changes: 1 addition & 1 deletion .github/workflows/bake-aarch64-alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake aarch64-alpine
type: boolean
default: false
schedule:
- cron: 47 0 3 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bake-aarch64-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake aarch64-debian
type: boolean
default: false
schedule:
- cron: 30 17 3 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bake-aarch64-fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake aarch64-fedora
type: boolean
default: false
schedule:
- cron: 55 9 6 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bake-aarch64-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake aarch64-ubuntu
type: boolean
default: false
schedule:
- cron: 46 21 5 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bake-amd64-alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake amd64-alpine
type: boolean
default: false
schedule:
- cron: 33 18 4 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bake-amd64-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake amd64-debian
type: boolean
default: false
schedule:
- cron: 11 3 5 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bake-amd64-fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake amd64-fedora
type: boolean
default: false
schedule:
- cron: 18 17 6 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bake-amd64-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake amd64-ubuntu
type: boolean
default: false
schedule:
- cron: 38 2 2 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bake-armv7hf-alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake armv7hf-alpine
type: boolean
default: false
schedule:
- cron: 16 4 5 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bake-armv7hf-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake armv7hf-debian
type: boolean
default: false
schedule:
- cron: 13 21 1 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bake-armv7hf-fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake armv7hf-fedora
type: boolean
default: false
schedule:
- cron: 6 12 5 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bake-armv7hf-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake armv7hf-ubuntu
type: boolean
default: false
schedule:
- cron: 55 4 7 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bake-i386-alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake i386-alpine
type: boolean
default: false
schedule:
- cron: 28 19 4 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bake-i386-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake i386-debian
type: boolean
default: false
schedule:
- cron: 14 19 1 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bake-i386-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake i386-ubuntu
type: boolean
default: false
schedule:
- cron: 48 6 1 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bake-rpi-alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake rpi-alpine
type: boolean
default: false
schedule:
- cron: 7 1 3 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bake-rpi-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Bake rpi-debian
type: boolean
default: false
schedule:
- cron: 0 13 2 * *
- cron: 1 2 3 * *
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
Expand Down
33 changes: 33 additions & 0 deletions .versionbot/CHANGELOG.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
- commits:
- subject: Use a fixed cron schedule to avoid changes on every run.
hash: 275ebe1f4fd835e92f5da5e1c4c3450480779ba1
body: ""
footer:
Change-type: patch
change-type: patch
Signed-off-by: Kyle Harding <[email protected]>
signed-off-by: Kyle Harding <[email protected]>
author: Kyle Harding
nested: []
- subject: Commit autogenerated files directly to PR head ref
hash: 467c65d8483a9fa7f135ddadb799929dfe5a8978
body: |
This avoids uploading of large patch files and hoping
they merge correctly on finalize.

Instead, the commits will be done upfront and included
with the PR changes.

To avoid having local copies become out-of-date during
development, it is preferred to generate these files
as part of the initial changes.
footer:
Change-type: patch
change-type: patch
Signed-off-by: Kyle Harding <[email protected]>
signed-off-by: Kyle Harding <[email protected]>
author: Kyle Harding
nested: []
version: 2.8.22
title: ""
date: 2023-10-16T19:49:41.105Z
- commits:
- subject: Fix branch name on push to master
hash: 3bb05a8ae9fdce1d9215bbc2332b86532c9cecbd
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## 2023-03-28

## 2.8.22 - 2023-10-16

* Use a fixed cron schedule to avoid changes on every run. [Kyle Harding]
* Commit autogenerated files directly to PR head ref [Kyle Harding]

## 2.8.21 - 2023-10-13

* Fix branch name on push to master [Kyle Harding]
Expand Down
Loading