Files
chromebrew/.github/workflows/Generate-PR.yml
chromebrew-actions[bot] 699ccd9957 Update Weston, fix filelist generation bug, adjust commit list in PRs — aml → 1.0.0,neatvnc → 0.10,weston → 14.0.2 (#12476)
* Add unbuilt weston to updater-weston-14.0.2

* Add hwdata dep.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Disable backend-vnc

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* updater-weston-14.0.2: Build Run on linux/arm/v7.

* updater-weston-14.0.2: Build Run on linux/amd64.

* updater-weston-14.0.2: Package File Update Run on linux/amd64 container.

* Adjust for neatvnc update.

* lint

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* lint

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Refactor weston to use new aml and neatvnc packages as deps.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* lint

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Fix commit list in Generate PR workflow.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Remove solitary lint from commit list.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* updater-weston-14.0.2: Package File Update Run on linux/amd64 container.

* updater-weston-14.0.2: Package File Update Run on linux/arm/v7 container.

* Catch files in dot subdirs under HOME when generating filelists.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Bump version further.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* updater-weston-14.0.2: Build Run on linux/amd64.

* updater-weston-14.0.2: Build Run on linux/arm/v7.

* updater-weston-14.0.2: Package File Update Run on linux/amd64 container.

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: satmandu <satmandu@users.noreply.github.com>
Co-authored-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: chromebrew-actions[bot] <chromebrew-actions[bot]@users.noreply.github.com>
2025-09-24 19:03:17 +00:00

475 lines
23 KiB
YAML

---
name: Generate PR
run-name: Generate PR for ${{ inputs.branch || github.ref_name }} by @${{ github.actor }}
on:
workflow_dispatch:
inputs:
draft_pr:
description: "Create a Draft PR."
required: false
type: boolean
default: 'false'
pr_title:
description: "Title of PR"
required: false
rebase:
description: "Rebase to master."
required: false
type: boolean
default: 'true'
update_package_files:
description: "Update Package Files."
required: false
type: boolean
default: 'true'
branch:
description: "Branch of chromebrew/chromebrew to run on, if different from this branch."
required: false
env:
BRANCH: ${{ inputs.branch || github.ref_name }}
permissions:
actions: write
contents: write
packages: write
pull-requests: write
repository-projects: read
jobs:
debug:
if: ${{ ( github.repository_owner == 'chromebrew' ) }}
runs-on: ubuntu-24.04
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
setup:
if: ${{ ( github.repository_owner == 'chromebrew' ) && ( inputs.branch != 'master' ) }}
runs-on: ubuntu-24.04
outputs:
changed_packages: ${{ steps.changed-packages.outputs.CHANGED_PACKAGES }}
glibc_232_compat: ${{ steps.get-compatibility.outputs.GLIBC_232_COMPATIBLE_PACKAGES }}
glibc_237_compat: ${{ steps.get-compatibility.outputs.GLIBC_237_COMPATIBLE_PACKAGES }}
i686_packages: ${{ steps.get-compatibility.outputs.i686_PACKAGES }}
x86_64_packages: ${{ steps.get-compatibility.outputs.x86_64_PACKAGES }}
armv7l_packages: ${{ steps.get-compatibility.outputs.armv7l_PACKAGES }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: true
ref: ${{ inputs.branch || github.ref_name }}
- name: Rebase to master
if: ${{ ( inputs.rebase ) }}
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
# git pull --rebase origin master
# git push -f
git fetch origin
git pull
git rebase -X theirs origin/master
git push --force-with-lease
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v47
with:
base_sha: master
files_yaml: |
packages:
- packages/*.rb
since_last_remote_commit: true
- name: Export variables to github context
id: changed-packages
run: |
# Convert "packages/foo.rb packages/bar.rb" (from steps.changed-files.outputs.packages_all_changed_files) into "foo bar"
echo "CHANGED_PACKAGES=$(echo "${{ steps.changed-files.outputs.packages_all_changed_files }}" | xargs basename -s .rb | xargs)" >> "$GITHUB_ENV"
echo "CHANGED_PACKAGES=$(echo "${{ steps.changed-files.outputs.packages_all_changed_files }}" | xargs basename -s .rb | xargs)" >> "$GITHUB_OUTPUT"
- name: Determine glibc and architecture package compatibility
id: get-compatibility
run: |
# If a package doesnt have a min_glibc value, or if it is below 2.32, add it to GLIBC_232_COMPATIBLE_PACKAGES.
GLIBC_232_COMPATIBLE_PACKAGES="$(for i in ${CHANGED_PACKAGES} ; do grep min_glibc packages/"${i}".rb | tr -d \' | awk '{exit $2 <= 2.32}' || echo "${i}" ; done | xargs)"
export GLIBC_232_COMPATIBLE_PACKAGES
if [[ -n ${GLIBC_232_COMPATIBLE_PACKAGES} ]]; then
echo "GLIBC_232_COMPATIBLE_PACKAGES=${GLIBC_232_COMPATIBLE_PACKAGES}" >> "$GITHUB_ENV"
echo "GLIBC_232_COMPATIBLE_PACKAGES=${GLIBC_232_COMPATIBLE_PACKAGES}" >> "$GITHUB_OUTPUT"
echo "Branch ${{ inputs.branch || github.ref_name }} has these possibly Glibc 2.32 compatible packages: ${GLIBC_232_COMPATIBLE_PACKAGES}"
fi
# If a package doesnt have a min_glibc value, or if it is below 2.37, add it to GLIBC_237_COMPATIBLE_PACKAGES.
GLIBC_237_COMPATIBLE_PACKAGES="$(for i in ${CHANGED_PACKAGES} ; do grep min_glibc packages/"${i}".rb | tr -d \' | awk '{exit $2 <= 2.37}' || echo "${i}" ; done | xargs)"
export GLIBC_237_COMPATIBLE_PACKAGES
if [[ -n ${GLIBC_237_COMPATIBLE_PACKAGES} ]]; then
echo "GLIBC_237_COMPATIBLE_PACKAGES=${GLIBC_237_COMPATIBLE_PACKAGES}" >> "$GITHUB_ENV"
echo "GLIBC_237_COMPATIBLE_PACKAGES=${GLIBC_237_COMPATIBLE_PACKAGES}" >> "$GITHUB_OUTPUT"
echo "Branch ${{ inputs.branch || github.ref_name }} has these possibly Glibc 2.37 compatible packages: ${GLIBC_237_COMPATIBLE_PACKAGES}"
fi
# If a package has a compatibility of 'all' or one that includes 'x86_64', add it to x86_64_PACKAGES.
x86_64_PACKAGES="$(for i in ${CHANGED_PACKAGES}; do grep -q "[[:space:]]compatibility.*all\|[[:space:]]compatibility.*x86_64" packages/"${i}".rb && echo "${i}"; done | xargs)"
export x86_64_PACKAGES
if [[ -n ${x86_64_PACKAGES} ]]; then
echo "x86_64_PACKAGES=${x86_64_PACKAGES}" >> "$GITHUB_ENV"
echo "x86_64_PACKAGES=${x86_64_PACKAGES}" >> "$GITHUB_OUTPUT"
echo "Branch ${{ inputs.branch || github.ref_name }} has these x86_64 compatible packages: ${x86_64_PACKAGES}"
fi
## If a package has a compatibility of 'all' or one that includes 'armv7l', add it to armv7l_PACKAGES.
armv7l_PACKAGES="$(for i in ${CHANGED_PACKAGES}; do grep -q "[[:space:]]compatibility.*all\|[[:space:]]compatibility.*armv7l" packages/"${i}".rb && echo "${i}"; done | xargs)"
export armv7l_PACKAGES
if [[ -n ${armv7l_PACKAGES} ]]; then
echo "armv7l_PACKAGES=${armv7l_PACKAGES}" >> "$GITHUB_ENV"
echo "armv7l_PACKAGES=${armv7l_PACKAGES}" >> "$GITHUB_OUTPUT"
echo "Branch ${{ inputs.branch || github.ref_name }} has these armv7l compatible packages: ${armv7l_PACKAGES}"
fi
## If a package has a compatibility of 'all' or one that includes 'i686', add it to i686_PACKAGES.
i686_PACKAGES="$(for i in ${CHANGED_PACKAGES}; do grep -q "[[:space:]]compatibility.*all\|[[:space:]]compatibility.*i686" packages/"${i}".rb && echo "${i}"; done | xargs)"
export i686_PACKAGES
if [[ -n ${i686_PACKAGES} ]]; then
echo "i686_PACKAGES=${i686_PACKAGES}" >> "$GITHUB_ENV"
echo "i686_PACKAGES=${i686_PACKAGES}" >> "$GITHUB_OUTPUT"
echo "Branch ${{ inputs.branch || github.ref_name }} has these i686 compatible packages: ${i686_PACKAGES}"
fi
update-package-files:
strategy:
max-parallel: 1
matrix:
arch: [i686, x86_64, armv7l]
runner:
- ubuntu-24.04
- ubuntu-24.04-arm
exclude:
- arch: x86_64
runner: ubuntu-24.04-arm
- arch: i686
runner: ubuntu-24.04-arm
- arch: armv7l
runner: ubuntu-24.04
runs-on: ${{ matrix.runner }}
needs:
- setup
env:
CREW_REPO: ${{ github.event.repository.clone_url }}
CREW_BRANCH: ${{ inputs.branch || github.ref_name }}
TARGET_ARCH: ${{ matrix.arch }}
GLIBC_232_COMPATIBLE_PACKAGES: ${{ needs.setup.outputs.glibc_232_compat }}
GLIBC_237_COMPATIBLE_PACKAGES: ${{ needs.setup.outputs.glibc_237_compat }}
i686_PACKAGES: ${{ needs.setup.outputs.i686_packages }}
x86_64_PACKAGES: ${{ needs.setup.outputs.x86_64_packages }}
armv7l_PACKAGES: ${{ needs.setup.outputs.armv7l_packages }}
if: ${{ !cancelled() && ( inputs.update_package_files ) }}
concurrency:
group: ${{ matrix.arch }}-${{ github.workflow }}-${{ inputs.branch || github.ref_name }}
cancel-in-progress: true
steps:
- name: Fail if build jobs failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: true
- name: Export target docker container to github context
run: |
case $TARGET_ARCH in
x86_64)
# Export the x86_64 container depending on whether this branch updates packages with appropriate minimum glibc.
if [[ $GLIBC_232_COMPATIBLE_PACKAGES ]]; then
echo "CONTAINER=satmandu/crewbuild:nocturne-x86_64.m97" >> "$GITHUB_ENV"
elif [[ $GLIBC_237_COMPATIBLE_PACKAGES ]]; then
echo "CONTAINER=satmandu/crewbuild:hatch-x86_64.m139" >> "$GITHUB_ENV"
else
echo "CONTAINER=satmandu/crew-pre-glibc-standalone:nocturne-x86_64.m90" >> "$GITHUB_ENV"
fi
echo "PLATFORM=linux/amd64" >> "$GITHUB_ENV"
echo "LIB_SUFFIX=64" >> "$GITHUB_ENV"
;;
armv7l)
# Export the armv7l container depending on whether this branch updates packages with appropriate minimum glibc.
if [[ $GLIBC_232_COMPATIBLE_PACKAGES ]]; then
echo "CONTAINER=satmandu/crewbuild:fievel-armv7l.m97" >> "$GITHUB_ENV"
elif [[ $GLIBC_237_COMPATIBLE_PACKAGES ]]; then
echo "CONTAINER=satmandu/crewbuild:strongbad-armv7l.m139" >> "$GITHUB_ENV"
else
echo "CONTAINER=satmandu/crew-pre-glibc-standalone:fievel-armv7l.m91" >> "$GITHUB_ENV"
fi
echo "PLATFORM=linux/arm/v7" >> "$GITHUB_ENV"
echo "LIB_SUFFIX=" >> "$GITHUB_ENV"
;;
i686)
# There is only one i686 container based upon M58 with glibc 2.23.
echo "CONTAINER=satmandu/crew-pre-glibc-standalone:alex-i686.m58" >> "$GITHUB_ENV"
echo "PLATFORM=linux/386" >> "$GITHUB_ENV"
echo "LIB_SUFFIX=" >> "$GITHUB_ENV"
;;
esac
- name: Run Updater in container
id: run-updater
if: ${{ ( inputs.update_package_files ) && ( contains(needs.*.result, 'failure') || !cancelled() ) }}
env:
UPDATE_PACKAGE_FILES: ${{ github.event.inputs.update_package_files }}
run: |
[[ "$UPDATE_PACKAGE_FILES" == 'false' ]] && exit 0
if [ "$PLATFORM" == 'linux/arm/v7' ] && [ -z "${armv7l_PACKAGES}" ]; then
# Exit the arm container if there are not armv7l compatible packages.
echo "Skipping armv7l container builds &/or package file updates."
exit 0
elif [ "$PLATFORM" == 'linux/amd64' ] && [ -z "${x86_64_PACKAGES}" ]; then
# Exit the x86_64 container if there are not x86_64 compatible packages.
echo "Skipping x86_64 container builds &/or package file updates"
exit 0
elif [ "$PLATFORM" == 'linux/386' ] && [ -z "${i686_PACKAGES}" ]; then
# Exit the i686 container if there are not i686 compatible packages.
echo "Skipping i686 container builds &/or package file updates"
exit 0
fi
git fetch origin
git checkout "${{ inputs.branch || github.ref_name }}"
git reset --hard "origin/${{ inputs.branch || github.ref_name }}"
git log --oneline -10
docker pull --platform "${PLATFORM}" "${CONTAINER}"
sudo apt install -y acl
# Detection of /output/pkg_cache dir triggers setting
# CREW_CACHE_DIR=1 and CREW_CACHE_ENABLED=1 in the build
# container. Without these, upload fails.
mkdir pkg_cache
sudo setfacl -R -m u:1000:rwx .
# See https://github.com/containerd/containerd/pull/7566#issuecomment-1461134737 for why we set ulimit.
docker run \
--rm \
--platform "${PLATFORM}" \
-e PUID=1000 \
-e PGID=1000 \
--privileged \
-e GCONV_PATH="/usr/local/lib${LIB_SUFFIX}/gconv" \
-e CREW_BUILD_NO_PACKAGE_FILE_HASH_UPDATES="${CREW_BUILD_NO_PACKAGE_FILE_HASH_UPDATES}" \
-e CREW_REPO="${CREW_REPO}" \
-e CREW_BRANCH="${{ inputs.branch || github.ref_name }}" \
-e GITLAB_TOKEN="${{ secrets.GITLAB_TOKEN }}" \
-e GITLAB_TOKEN_USERNAME="${{ secrets.GITLAB_TOKEN_USERNAME }}" \
-v "$(pwd)"/pkg_cache:/usr/local/tmp/packages:rshared \
-v "$(pwd)":/output:rshared \
--tmpfs /tmp \
--ulimit "nofile=$(ulimit -Sn):$(ulimit -Hn)" \
"${CONTAINER}" \
/bin/chromebrewstart "/output/tools/github_actions_update_builder_allowing_failures.sh" > >(tee -a /tmp/build.log) 2> >(tee -a /tmp/build.log >&2)
grep "Built and Uploaded:" /tmp/build.log || true
echo "Deleting build output directories."
sudo rm -rf release pkg_cache
- name: Add updated packages to branch.
id: push-check
run: |
if [ -n "$(git status --porcelain)" ]; then
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git stash || true
git pull
git stash pop || true
git add -A
git commit -m "${{ inputs.branch || github.ref_name }}: Package File Update Run on ${PLATFORM} container." && git push
git log --oneline -10
fi
build-check:
runs-on: ubuntu-24.04
needs:
- setup
- update-package-files
if: ${{ ( always() && !cancelled() ) && needs.setup.result == 'success' && ((( inputs.update_package_files ) && needs.update-package-files.result == 'success') || !( inputs.update_package_files )) }}
steps:
- name: Fail if update or build jobs failed, otherwise create a PR
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
- name: Report update & build success
run: echo "Update & build jobs succeeded. Creating a PR."
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: true
ref: ${{ inputs.branch || github.ref_name }}
- name: Install ruby-libversion # Hopefully this will get added as an Ubuntu/Debian package. https://github.com/repology/libversion/issues/35
working-directory: ${{ runner.temp }}
run: |
git clone --depth 1 -b 3.0.3 https://github.com/repology/libversion
cd libversion
mkdir build
cd build
cmake ..
make -j "$(nproc)"
sudo make install
sudo gem install ruby-libversion
- name: Rebase to master and save git log
id: rebase-and-git-log
env:
REBASE: ${{ inputs.rebase }}
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git fetch origin
git checkout "${{ inputs.branch || github.ref_name }}"
if [[ ${REBASE} == 'true' ]]; then
git reset --hard "origin/${{ inputs.branch || github.ref_name }}"
git pull
git rebase -X theirs origin/master
git push --force-with-lease
# git pull --rebase origin master && git push -f
fi
git log --oneline -10
git checkout master && git pull
git log --oneline master..${{ inputs.branch || github.ref_name }} | grep -v "Merge branch 'master'\|Build Run on\|Package File Update Run on\|lint$" | tr '\n' '\0' | xargs -0 -n1 echo "- $*" >> /tmp/commits.txt
git checkout "${{ inputs.branch || github.ref_name }}"
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v47
with:
base_sha: master
files_yaml: |
manifest:
- manifest/**
packages:
- packages/*.rb
github:
- .github/**
other:
- ./**
- '!manifest/**'
- '!packages/*.rb'
- '!.github/**'
since_last_remote_commit: true
- name: Get GH Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v4
with:
application_id: ${{ secrets.APPLICATION_ID }}
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
organization: chromebrew
revoke_token: true
- name: Create Pull Request
env:
CHANGED_GITHUB_CONFIG_FILES: ${{ steps.changed-files.outputs.github_all_changed_files }}
CHANGED_MANIFEST_FILES: ${{ steps.changed-files.outputs.manifest_all_changed_files }}
CHANGED_OTHER_FILES: ${{ steps.changed-files.outputs.other_all_changed_files }}
CHANGED_PACKAGES: ${{ needs.setup.outputs.changed_packages }}
CREW_BRANCH: ${{ inputs.branch || github.ref_name }}
DRAFT_PR: ${{ inputs.draft_pr }}
GH_TOKEN: ${{ steps.get_workflow_token.outputs.token }}
PR_TITLE: ${{ inputs.pr_title }}
i686_PACKAGES: ${{ needs.setup.outputs.i686_packages }}
x86_64_PACKAGES: ${{ needs.setup.outputs.x86_64_packages }}
armv7l_PACKAGES: ${{ needs.setup.outputs.armv7l_packages }}
run: |
sudo gem install ptools
function join_by { local IFS="$1"; shift; echo "$*"; }
rm -rf /tmp/pr.txt
echo -e "## Description" >> /tmp/pr.txt
echo -e "#### Commits:" >> /tmp/pr.txt
# Get git log from rebase-and-git-log step.
cat /tmp/commits.txt >> /tmp/pr.txt
if [[ "${CHANGED_GITHUB_CONFIG_FILES}" != "" ]]; then
echo -e "### Updated GitHub configuration files:" >> /tmp/pr.txt
for file in ${CHANGED_GITHUB_CONFIG_FILES}
do
echo "- ${file}" >> /tmp/pr.txt
done
fi
if [[ "${CHANGED_PACKAGES}" != "" ]]; then
echo -e "### Packages with Updated versions or Changed package files:" >> /tmp/pr.txt
for file in ${CHANGED_PACKAGES}
do
pkg_version="$(LD_LIBRARY_PATH=/usr/local/lib ruby tools/version.rb -j "${file}" | jq -r '.[]|.version')"
upstream_version="$(LD_LIBRARY_PATH=/usr/local/lib ruby tools/version.rb -j "${file}" | jq -r '.[]|.upstream_version')"
if [[ -z "$pkg_version" ]]; then
echo "- ${file}" >> /tmp/pr.txt
PKG_DELTA+=( "${file}" )
elif [[ -z "$upstream_version" ]]; then
echo "- \`${file}\` &rarr; ${pkg_version}" >> /tmp/pr.txt
PKG_DELTA+=( "${file} → ${pkg_version}" )
elif [[ "$pkg_version" == "$upstream_version" ]]; then
echo "- \`${file}\` &rarr; ${pkg_version}" >> /tmp/pr.txt
PKG_DELTA+=( "${file} → ${pkg_version}" )
else
echo "- \`${file}\` &rarr; ${pkg_version} (current version is ${upstream_version})" >> /tmp/pr.txt
PKG_DELTA+=( "${file} → ${pkg_version}" )
fi
done
echo -e "##\nBuilds attempted for:" >> /tmp/pr.txt
[ -n "${x86_64_PACKAGES}" ] && echo -e "- [x] \`x86_64\`" >> /tmp/pr.txt
[ -n "${i686_PACKAGES}" ] && echo -e "- [x] \`i686\`" >> /tmp/pr.txt
[ -n "${armv7l_PACKAGES}" ] && echo -e "- [x] \`armv7l\`" >> /tmp/pr.txt
fi
if [[ "${CHANGED_OTHER_FILES}" != "" ]]; then
echo -e "### Other changed files:" >> /tmp/pr.txt
for file in ${CHANGED_OTHER_FILES}
do
echo "- ${file}" >> /tmp/pr.txt
done
fi
if [[ "${CHANGED_MANIFEST_FILES}" == "" ]]; then
echo -e "##\n- [x] This PR has no manifest .filelist changes. _(Package changes have neither added nor removed files.)_" >> /tmp/pr.txt
fi
echo -e "##\n### Run the following to get this pull request's changes locally for testing.\n\`\`\`bash" >> /tmp/pr.txt
echo -e "CREW_REPO=https://github.com/chromebrew/chromebrew.git CREW_BRANCH=${{ inputs.branch || github.ref_name }} crew update \\" >> /tmp/pr.txt
echo -e "&& yes | crew upgrade\n\`\`\`" >> /tmp/pr.txt
[[ -n "${PKG_DELTA[*]}" ]] && PKG_DELTAS="— $(join_by , "${PKG_DELTA[@]}")"
echo "PKG_DELTAS: $PKG_DELTAS"
cat /tmp/pr.txt
[[ ${DRAFT_PR} == 'true' ]] && export PR_DRAFT_FLAG='-d'
PR_NUMBER=$(gh pr list -L 1 -s open -H ${{ inputs.branch || github.ref_name }} | cut -f1)
PR_TITLE_INPUT="${{ inputs.pr_title }}"
if [[ -z ${PR_TITLE_INPUT} ]]; then
PR_TITLE="$(git log --oneline master..${{ inputs.branch || github.ref_name }} | grep -v "Merge branch 'master'\|Build Run on\|Package File Update Run on" | tail -n 1 | cut -c 11-)"
else
PR_TITLE="${{ inputs.pr_title }}"
fi
echo "PR title is: $(echo "${PR_TITLE}" | sed -e "s/^'//" -e "s/'$//") ${PKG_DELTAS}"
if [[ -z ${PR_NUMBER} ]]; then
PR_NUMBER=$(gh pr create ${PR_DRAFT_FLAG} --reviewer chromebrew/active --title "$(echo "${PR_TITLE}" | sed -e "s/^'//" -e "s/'$//") ${PKG_DELTAS}" -F /tmp/pr.txt | rev | cut -d"/" -f1 | rev)
else
gh pr edit --add-reviewer chromebrew/active --title "$(echo "${PR_TITLE}" | sed -e "s/^'//" -e "s/'$//") ${PKG_DELTAS}" -F /tmp/pr.txt
fi
# Draft PRs can not be set to automerge.
if [[ ${DRAFT_PR} == 'true' ]]; then
gh pr ready --undo || true
else
gh pr ready || true
gh pr merge --auto || true
fi
echo "PR_NUMBER is ${PR_NUMBER}"
echo "PR_NUMBER=${PR_NUMBER}" >> "$GITHUB_ENV"
# Trigger workflow runs:
gh workflow run Unit-Test.yml -R ${{ github.repository }} -r ${{ inputs.branch || github.ref_name }}
gh workflow run Linter-Handoff.yml -R ${{ github.repository }} -r ${{ inputs.branch || github.ref_name }}