Skip to content

APT Package Promotion Checks #336

APT Package Promotion Checks

APT Package Promotion Checks #336

name: APT Package Promotion Checks
on:
schedule:
# Run on weekdays at midnight
- cron: "0 0 * * 1-5"
workflow_dispatch:
branches:
- master
jobs:
package-promotion-check:
runs-on: ubuntu-20.04
strategy:
matrix:
base_repo: [pi-top-os-unstable, pi-top-os-testing]
dest_repo: [pi-top-os]
distro: [bullseye, bookworm]
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Install package-cloud-cli
run: |
cd scripts/package-cloud-cli
pip3 install .
- name: Check for possible promotions
id: promotions
run: |
PC_API_TOKEN=${{ secrets.PACKAGECLOUD_TOKEN }} \
PC_DISTRO=debian \
PC_DISTRO_VERSION=${{ matrix.distro }} \
PC_USER=pi-top \
PC_REPO=${{ matrix.base_repo }} \
package-cloud --all-packages --promote-check --additional-repo ${{ matrix.dest_repo }} >> ${{ matrix.base_repo }}-to-${{ matrix.dest_repo }}.txt
COMMAND_OUTPUT=$(cat ${{ matrix.base_repo }}-to-${{ matrix.dest_repo }}.txt)
COMMAND_OUTPUT="${COMMAND_OUTPUT//'%'/'%25'}"
COMMAND_OUTPUT="${COMMAND_OUTPUT//$'\n'/'%0A'}"
COMMAND_OUTPUT="${COMMAND_OUTPUT//$'\r'/'%0D'}"
COMMAND_OUTPUT="${COMMAND_OUTPUT//$'\''/\`}"
echo "::set-output name=COMMAND_OUTPUT::$COMMAND_OUTPUT"
- name: Send message to Slack API
if: steps.promotions.outputs.COMMAND_OUTPUT
uses: archive/github-actions-slack@v2.0.0
with:
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_PACKAGE_PROMOTER_TOKEN }}
slack-channel: C02UEAAHK3R
slack-text: "For ${{ matrix.distro }}:\n\r${{ steps.promotions.outputs.COMMAND_OUTPUT }}"