Skip to content

Weekly Jobs

Weekly Jobs #15

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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- 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@08259812c8ebdbf1973747f9297e332fa078d3c1 # v2.4.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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ needs.build_branch.outputs.branch_name }}
submodules: true
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 #v2.16.0
with:
channel: 'stable'
cache: ${{ needs.build_branch.outputs.build_id != '' }}
cache-key: ${{ needs.build_branch.outputs.build_id }}
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.9'
- uses: ts-graphviz/setup-graphviz@d5b2b6b67007094b256f3fd2fa6cf0ac41ceef25 # v2.0.0
- 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: Commit changes
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
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?";