mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-07 22:54:11 -05:00
Add merge master option back to workflows. (#12960)
* Add merge master option back to workflows. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Remove unnecessary 'apt install acl' line. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add updater label to PRs generated with the Updater workflows. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add unbuilt vulkan_icd_loader to updater-vulkan_icd_loader-1.4.328 — vulkan_icd_loader → 1.4.328 (#12961) * Add unbuilt vulkan_icd_loader to updater-vulkan_icd_loader-1.4.328 * updater-vulkan_icd_loader-1.4.328: Package File Update Run on linux/amd64 container. * updater-vulkan_icd_loader-1.4.328: Package File Update Run on linux/arm/v7 container. --------- Co-authored-by: satmandu <satmandu@users.noreply.github.com> Co-authored-by: chromebrew-actions[bot] <220035932+chromebrew-actions[bot]@users.noreply.github.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Default Update Branch to false for Generate PR workflow. Signed-off-by: Satadru Pramanik <satadru@gmail.com> --------- Signed-off-by: Satadru Pramanik <satadru@gmail.com> Co-authored-by: chromebrew-actions[bot] <220035932+chromebrew-actions[bot]@users.noreply.github.com> Co-authored-by: satmandu <satmandu@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
8096639913
commit
1b4c9b388f
14
.github/workflows/Build.yml
vendored
14
.github/workflows/Build.yml
vendored
@@ -24,6 +24,14 @@ on:
|
||||
branch:
|
||||
description: "Branch of chromebrew/chromebrew to run on, if different from this branch."
|
||||
required: false
|
||||
update_merge_master:
|
||||
description: "Update Branch."
|
||||
required: false
|
||||
type: boolean
|
||||
default: 'true'
|
||||
pr_label:
|
||||
description: "PR Label"
|
||||
required: false
|
||||
env:
|
||||
BRANCH: ${{ inputs.branch || github.ref_name }}
|
||||
permissions:
|
||||
@@ -75,6 +83,9 @@ jobs:
|
||||
if [[ -n ${PR_NUMBER} ]]; then
|
||||
echo "Setting ${PR_NUMBER} to Draft while workflow runs."
|
||||
gh pr ready --undo || true
|
||||
# Try to update branch before building if a PR already
|
||||
# exists.
|
||||
[[ "${{ ( inputs.update_merge_master ) }}" == 'true' ]] && gh pr update-branch || true
|
||||
fi
|
||||
- name: Set Timestamp
|
||||
id: set-timestamp
|
||||
@@ -268,7 +279,6 @@ jobs:
|
||||
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.
|
||||
@@ -338,4 +348,4 @@ jobs:
|
||||
PR_TITLE: ${{ inputs.pr_title || inputs.branch || github.ref_name }}
|
||||
run: |
|
||||
echo "PR title being passed to the Generate PR workflow is: ${{ inputs.pr_title || inputs.branch || github.ref_name }}"
|
||||
gh workflow run Generate-PR.yml -R ${{ github.repository }} -r ${{ inputs.branch || github.ref_name }} -f branch="${{ inputs.branch || github.ref_name }}" -f draft_pr="${{ github.event.inputs.with_pr == 'Draft Pull Request' }}" -f pr_title="$(echo "${{ inputs.pr_title || inputs.branch || github.ref_name }}" | ( read -rsd '' x; echo ${x@Q} ))"
|
||||
gh workflow run Generate-PR.yml -R ${{ github.repository }} -r ${{ inputs.branch || github.ref_name }} -f branch="${{ inputs.branch || github.ref_name }}" -f pr_label="${{ inputs.pr_label }}" -f draft_pr="${{ github.event.inputs.with_pr == 'Draft Pull Request' }}" -f pr_title="$(echo "${{ inputs.pr_title || inputs.branch || github.ref_name }}" | ( read -rsd '' x; echo ${x@Q} ))"
|
||||
|
||||
49
.github/workflows/Generate-PR.yml
vendored
49
.github/workflows/Generate-PR.yml
vendored
@@ -12,6 +12,11 @@ on:
|
||||
pr_title:
|
||||
description: "Title of PR"
|
||||
required: false
|
||||
update_merge_master:
|
||||
description: "Update Branch."
|
||||
required: false
|
||||
type: boolean
|
||||
default: 'false'
|
||||
update_package_files:
|
||||
description: "Update Package Files."
|
||||
required: false
|
||||
@@ -20,6 +25,9 @@ on:
|
||||
branch:
|
||||
description: "Branch of chromebrew/chromebrew to run on, if different from this branch."
|
||||
required: false
|
||||
pr_label:
|
||||
description: "PR Label"
|
||||
required: false
|
||||
env:
|
||||
BRANCH: ${{ inputs.branch || github.ref_name }}
|
||||
permissions:
|
||||
@@ -71,6 +79,18 @@ jobs:
|
||||
echo "Setting ${PR_NUMBER} to Draft while workflow runs."
|
||||
gh pr ready --undo || true
|
||||
fi
|
||||
if [[ "${{ ( inputs.update_merge_master ) }}" == 'true' ]]; then
|
||||
if [[ -n ${PR_NUMBER} ]]; then
|
||||
# Try to update branch immediately.
|
||||
gh pr update-branch || true
|
||||
else
|
||||
gh pr create -d -b WIP -t "WIP ${{ inputs.branch || github.ref_name }}"
|
||||
# Create a draft PR and immediately try to update the branch
|
||||
# before continuing.
|
||||
gh pr update-branch || true
|
||||
fi
|
||||
git pull
|
||||
fi
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v47
|
||||
@@ -82,10 +102,16 @@ jobs:
|
||||
since_last_remote_commit: true
|
||||
- name: Export variables to github context
|
||||
id: changed-packages
|
||||
env:
|
||||
CHANGED_FILES: ${{ steps.changed-files.outputs.packages_all_changed_files }}
|
||||
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"
|
||||
if [[ -n "${CHANGED_FILES}" ]]; then
|
||||
# Convert "packages/foo.rb packages/bar.rb" (from steps.changed-files.outputs.packages_all_changed_files) into "foo bar"
|
||||
echo "CHANGED_PACKAGES=$(echo "${CHANGED_FILES}" | xargs basename -s .rb | xargs)" >> "$GITHUB_ENV"
|
||||
echo "CHANGED_PACKAGES=$(echo "${CHANGED_FILES}" | xargs basename -s .rb | xargs)" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "No Changed Files."
|
||||
fi
|
||||
- name: Determine glibc and architecture package compatibility
|
||||
id: get-compatibility
|
||||
run: |
|
||||
@@ -257,7 +283,6 @@ jobs:
|
||||
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.
|
||||
@@ -370,6 +395,7 @@ jobs:
|
||||
CREW_BRANCH: ${{ inputs.branch || github.ref_name }}
|
||||
DRAFT_PR: ${{ inputs.draft_pr }}
|
||||
GH_TOKEN: ${{ steps.get_workflow_token.outputs.token }}
|
||||
PR_LABEL: ${{ inputs.pr_label }}
|
||||
PR_TITLE: ${{ inputs.pr_title }}
|
||||
i686_PACKAGES: ${{ needs.setup.outputs.i686_packages }}
|
||||
x86_64_PACKAGES: ${{ needs.setup.outputs.x86_64_packages }}
|
||||
@@ -430,7 +456,6 @@ jobs:
|
||||
[[ -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
|
||||
@@ -439,11 +464,17 @@ jobs:
|
||||
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
|
||||
if [[ -n "${PR_LABEL}" ]]; then
|
||||
export PR_CREATE_LABEL_FLAG="--label ${{ inputs.pr_label }}"
|
||||
export PR_EDIT_LABEL_FLAG="--add-label ${{ inputs.pr_label }}"
|
||||
fi
|
||||
if [[ -z ${PR_NUMBER} ]]; then
|
||||
PR_NUMBER=$(gh pr create -d --reviewer chromebrew/active $PR_CREATE_LABEL_FLAG --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 $PR_EDIT_LABEL_FLAG --title "$(echo "${PR_TITLE}" | sed -e "s/^'//" -e "s/'$//") ${PKG_DELTAS}" -F /tmp/pr.txt
|
||||
fi
|
||||
# Try to update branch before finishing.
|
||||
[[ "${{ ( inputs.update_merge_master ) }}" == 'true' ]] && gh pr update-branch || true
|
||||
# Draft PRs can not be set to automerge.
|
||||
if [[ ${DRAFT_PR} == 'true' ]]; then
|
||||
gh pr ready --undo || true
|
||||
|
||||
1
.github/workflows/No-Compile-Needed.yml
vendored
1
.github/workflows/No-Compile-Needed.yml
vendored
@@ -272,7 +272,6 @@ jobs:
|
||||
git reset --hard "origin/${{ inputs.branch || github.ref_name }}"
|
||||
git log --oneline -10
|
||||
docker pull --platform "${PLATFORM}" "${CONTAINER}"
|
||||
sudo apt install -y acl
|
||||
sudo setfacl -R -m u:1000:rwx .
|
||||
|
||||
# Use docker-in-docker shim to mount volume inside docker.
|
||||
|
||||
2
.github/workflows/Updater-on-Demand.yml
vendored
2
.github/workflows/Updater-on-Demand.yml
vendored
@@ -83,7 +83,7 @@ jobs:
|
||||
# is ok.
|
||||
git commit -m "Add unbuilt ${pkg} to ${updater_branch}" || true
|
||||
git push origin "HEAD:${updater_branch}" -f || true
|
||||
gh workflow -R chromebrew/chromebrew run Build.yml -f branch="${updater_branch}"
|
||||
gh workflow -R chromebrew/chromebrew run Build.yml -f branch="${updater_branch}" -f pr_label=updater
|
||||
git stash || true
|
||||
git checkout master
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user