Skip to content

Check git apply

Check git apply #157

name: Check git apply
#permissions:
# actions: none
# checks: none
# contents: none
# deployments: none
# issues: none
# packages: none
# pull-requests: write
# repository-projects: none
# security-events: none
# statuses: none
on:
# push:
# branches-ignore:
# - 'ci'
workflow_dispatch:
inputs:
rtag:
description: 'uazo/cromite TAG or COMMIT'
required: true
default: ''
env:
RTAG: ${{ github.event.inputs.rtag }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Get value from dispatch"
run: |
if [ -z "${RTAG}" ]; then
echo "RTAG=$GITHUB_SHA" >> $GITHUB_ENV
echo "RTAG=$RTAG"
fi
- name: Prepare container
run: |
sudo apt update
sudo apt install -y wget unzip tar sed dos2unix patchutils wiggle curl
wget https://github.com/uazo/superpatch/releases/latest/download/SuperPatchUtils.tar.gz
tar xfz SuperPatchUtils.tar.gz
rm SuperPatchUtils.tar.gz
wget https://github.com/ericchiang/pup/releases/download/v0.4.0/pup_v0.4.0_linux_amd64.zip
unzip pup_v0.4.0_linux_amd64.zip
rm pup_v0.4.0_linux_amd64.zip
BRANCH=$(curl https://github.com/uazo/cromite/branch_commits/$RTAG | ./pup -p li.branch:last-child a text{})
if [ -z "${BRANCH}" ]; then
BRANCH=$(curl https://github.com/uazo/cromite/branch_commits/$RTAG a | ./pup -p li.branch:first-child a text{})
fi
if [ -z "${BRANCH}" ]; then
echo "Can not recover the base commit"
exit 1
fi
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
- name: Checkout 'uazo/cromite' ${{ env.BRANCH }}
uses: actions/checkout@v2
with:
repository: 'uazo/cromite'
ref: ${{ github.event.inputs.rtag }}
path: 'cromite'
fetch-depth: 1
- name: Check chromium version
run: |
VERSION=$(cat cromite/build/RELEASE)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Cache chromium sources
uses: actions/cache@v3
with:
path: /home/runner/work/cromite/cromite/chromium/src
key: chrsource-${{ env.VERSION }}
- name: Download chromium ${{ env.VERSION }} sources
run: |
export HOME=$(pwd)
./bin/SuperPatchUtils bromite $RTAG ~/chromium-src
mkdir -p ~/chromium/src && cp -r ~/chromium-src ~/chromium/src
cd ~/chromium/src
git init
git config user.email "[email protected]"
git config user.name "Your Name"
git add .
git commit -m $VERSION
git tag -a $VERSION -m $VERSION
- name: Apply patches ${{ github.event.inputs.rtag }}
run: |
export HOME=$(pwd)
cd ~/chromium/src
export SILENT=true
export SKIPAUTOGENERATED=true
bash ~/cromite/tools/apply-all-patch.sh || exit 1
rm -rf ~/cromite/build/patches-new/
rm ~/cromite/build/bromite_patches_list_new.txt
- name: Export patches
run: |
export HOME=$(pwd)
cd ~/chromium/src
bash ~/cromite/tools/export-all-patch.sh
cd ~/cromite
rm -rf build/patches/*
mv build/patches-new/* build/patches
rm -rf build/patches-new/
- name: Check differences CHANGES=${{ env.CHANGES }}
run: |
cd cromite
CHANGES=0 && git diff --quiet || CHANGES=1
echo "CHANGES=$CHANGES" >> $GITHUB_ENV
if [[ CHANGES -eq 1 ]]; then
git add build/patches/*.patch
git diff --name-only --staged
# MESSAGE=$(git diff --name-only --staged)
# echo "MESSAGE='$MESSAGE'" >> $GITHUB_ENV
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@dcd5fd746d53dd8de555c0f10bca6c35628be47a #v3.12.0
if: env.CHANGES == '1'
with:
path: cromite
base: ${{ env.BRANCH }}
#push-to-fork: uazo/cromite
add-paths: |
build/patches/*.patch
commit-message: 'AUTOMATED - git apply results'
title: Git apply result for ${{ env.BRANCH }} branch
body: ${{ env.MESSAGE }}
delete-branch: true
branch-suffix: short-commit-hash