TO-DROP: trigger drop-pacman-package-from-sdks via push #9
This file contains hidden or 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: Drop Pacman package from SDKs | |
on: | |
push: | |
env: | |
PACKAGE: git-flow | |
COMMIT_MESSAGE: The Git Flow package is obsolete and unmaintained. It is no longer distributed with Git for Windows, see https://github.com/git-for-windows/build-extra/pull/648 for details. | |
GIT_CONFIG_PARAMETERS: "'user.name=Git for Windows Build Agent' '[email protected]' 'windows.sdk64.path=${{ github.workspace }}' 'windows.sdk32.path=' 'http.sslbackend=schannel' 'core.autocrlf=false' 'checkout.workers=56'" | |
HOME: "${{ github.workspace }}\\home\\git-ci" | |
MSYSTEM: MSYS | |
jobs: | |
drop-pacman-package: | |
strategy: | |
matrix: | |
sdk: [git-sdk-64, git-sdk-arm64, git-sdk-32] | |
runs-on: ${{ matrix.sdk == 'git-sdk-arm64' && 'windows-11-arm' || 'windows-latest' }} | |
steps: | |
- name: obtain installation access token | |
uses: actions/create-github-app-token@v2 | |
id: sdk-repo-token | |
with: | |
app-id: ${{ secrets.GH_APP_ID }} | |
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} | |
owner: ${{ github.repository_owner }} | |
repositories: ${{ matrix.sdk }} | |
- name: clone ${{ matrix.sdk }} | |
uses: actions/checkout@v5 | |
with: | |
persist-credentials: true | |
repository: ${{ github.repository_owner }}/${{ matrix.sdk }} | |
token: ${{ steps.sdk-repo-token.outputs.token }} | |
- name: use the SDK's Bash and git.exe | |
run: "usr\\bin\\bash.exe -lc 'cygpath -aw /usr/bin >>$GITHUB_PATH && cygpath -aw /cmd >>$GITHUB_PATH'" | |
- name: Remove ${{ env.PACKAGE }} | |
shell: bash | |
run: | | |
set -x && | |
. /etc/profile && | |
# Log the output also to a file so that it can be inserted into the commit message later | |
cygpath -aw /tmp/commit-message.txt && | |
( | |
set -x && | |
pacman -Rns --noconfirm $PACKAGE; | |
echo $? >/tmp/exit.status | |
) 2>&1 | | |
tee -a /tmp/commit-message.txt && | |
exit $(cat /tmp/exit.status) | |
- name: commit & open PR | |
shell: bash | |
run: | | |
set -x && | |
branch="drop-$PACKAGE-$(date +%s)" && | |
git switch -c "$branch" && | |
git add -A . && | |
if git diff --cached --quiet; then | |
echo "::warning::${{ matrix.sdk }}: no changes to commit!" | |
exit 0 | |
fi && | |
commit_message="Drop package '$PACKAGE' | |
$COMMIT_MESSAGE | |
Here is the output of the command that was run in | |
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}: | |
$(cat /tmp/commit-message.txt)" && | |
git commit -m "$commit_message" && | |
git push origin "$branch" && | |
( | |
GH_TOKEN="${{ steps.sdk-repo-token.outputs.token }}" \ | |
gh pr create \ | |
--fill \ | |
--head "$branch" \ | |
--base main 2>&1; | |
echo $? >/tmp/exit.status | |
) | | |
tee -a /tmp/pr-create-output.txt && | |
test 0 = $(cat /tmp/exit.status) && | |
sed -n 's/.*\(http[^ ]*\).*/::notice::Opened PR \1/p' /tmp/pr-create-output.txt |