Skip to content

Weekly Jobs

Weekly Jobs #72

Workflow file for this run

name: Weekly Jobs
on:
schedule:
- cron: "53 4 * * 6" # 4:53 every saturday
workflow_dispatch:
jobs:
build_branch:
runs-on: ubuntu-20.04
outputs:
build_id: ${{ steps.build.outputs.build_id }}
branch_name: ${{ steps.branch_name.outputs.generated }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Generate build id
id: build
uses: ./.github/composite/build-id
- name: Generate Branch Name
id: branch_name
run: |
echo "generated=$(date -I)" >> $GITHUB_OUTPUT
- uses: peterjgrainger/action-create-branch@10c7d268152480ae859347db45dc69086cef1d9c # v3.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: ${{ steps.branch_name.outputs.generated }}
sha: ${{ steps.build.outputs.commit_ref }}
package-analysis:
runs-on: ubuntu-20.04
needs:
- build_branch
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ needs.build_branch.outputs.branch_name }}
submodules: true
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff #v2.18.0
with:
channel: "stable"
cache: ${{ needs.build_branch.outputs.build_id != '' }}
cache-key: ${{ needs.build_branch.outputs.build_id }}
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: "3.9"
- uses: ts-graphviz/setup-graphviz@b1de5da23ed0a6d14e0aeee8ed52fdd87af2363c # v2.0.2
- uses: ./.github/composite/update-submodules
- name: Install melos
run: dart pub get
shell: bash
- name: Run melos analysis
shell: bash
env:
TMP: ${{ runner.temp }}
run: |
dart run melos ls -r --json -l --ignore='*example*' >> "$TMP/melos-json.json"
dart run melos ls -r --graph --ignore='*example*' >> "$TMP/melos-graph.json"
dart run melos ls -r --gviz --ignore='*example*' >> "$TMP/melos-gviz.gv"
- name: Execute diagram generator
shell: bash
env:
TMP: ${{ runner.temp }}
run: |
chmod +w ./docs/diagrams/*
pip install -r ./tools/package_diagrams.requirements.txt
python ./tools/package_diagrams.py "$TMP/melos-gviz.gv" "$GITHUB_WORKSPACE/docs/diagrams"
- name: Authenticate GitHub CLI
run: |
echo -e ${{ secrets.MY_GITHUB_TOKEN }} | gh auth login --with-token
- name: Check for changes
id: git-status
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "There are changes to commit"
echo "has_changes=true" >> "$GITHUB_OUTPUT"
else
echo "No changes to commit"
echo "has_changes=false" >> "$GITHUB_OUTPUT"
fi
- name: Commit changes
if: ${{ steps.git-status.outputs.has_changes == 'true' }}
run: |
git config --global user.name library-action[bot]
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
git commit -am "ci(automated): checkin weekly job"
git push origin ${{ needs.backup.outputs.branch_name }}
- name: create pull request
if: ${{ steps.git-status.outputs.has_changes == 'true' }}
run: |
gh pr create \
--base 'trunk' \
--head ${{ needs.build_branch.outputs.branch_name }} \
--reviewer 'xavierchanth' \
--title 'ci: backup ${{ needs.backup.outputs.branch_name }}' \
--body 'Sync weekly job' || \
echo "Already created?";
- run: dart run melos bootstrap
- name: Create dependency report
run: |
cat <<-EOF >./generate_report.sh
dst="$(pwd)/dependency_reports/"
timestamp=\$(date -u +%s);
package=\$(dart pub deps | head -n 10 | grep -v 'SDK' | head -n 1 | cut -d' ' -f1 | tr -d '[:space:]');
filename="./\${timestamp}_\${package}_report.txt"
echo "running in package: \$package"
dart pub outdated | tee "\$filename"
dart analyze | tee "\$filename"
echo "copying \$filename to \$dst"
mv \$filename "\$dst"
EOF
chmod +x ./generate_report.sh
mkdir ./dependency_reports
dart run melos exec -fo -- $(pwd)/generate_report.sh
- name: Upload dependency report
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name:
at_mono_dependency_reports_${{
needs.build_branch.outputs.branch_name }}
path: ./dependency_reports/
if-no-files-found: error