Daily project update scan #1128
This file contains 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: Daily project update scan | |
on: | |
schedule: | |
- cron: '0 */8 * * *' | |
workflow_dispatch: | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.matrix.outputs.matrix }} | |
steps: | |
- name: Check out git repo | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install requests | |
- name: Run project-release-scan.py | |
id: matrix | |
run: | | |
.github/bin/project-release-scan.py ${{ secrets.GITHUB_TOKEN }} >/tmp/matrix | |
cat /tmp/matrix | |
echo "matrix=$(cat /tmp/matrix)" >> $GITHUB_OUTPUT | |
rm /tmp/matrix | |
Notification: | |
if: ${{ needs.setup.outputs.matrix != '' }} | |
needs: | |
- setup | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: "${{ fromJson(needs.setup.outputs.matrix) }}" | |
steps: | |
- name: Check out git repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set pr_branch_name variable | |
run: | | |
echo "pr_branch_name=version-update-${{ matrix.name }}-${{ matrix.current_release }}" >> $GITHUB_ENV | |
- name: Set create_pr variable if PR branch already exists | |
id: create_pr | |
run: | | |
if git show-ref --quiet ${{ env.pr_branch_name }}; then | |
echo "Branch ${{ env.pr_branch_name }} already exists, setting create_pr=false.." | |
create_pr=false | |
else | |
echo "Branch ${{ env.pr_branch_name }} DOES NOT exist, setting create_pr=true.." | |
create_pr=true | |
fi | |
echo "create_pr=${create_pr}" >> $GITHUB_ENV | |
- name: Update VERSION file | |
if: ${{ env.create_pr == 'true' }} | |
run: | | |
echo "${{ matrix.current_release }}" > ${{ matrix.name }}/VERSION | |
- name: Create Pull Request | |
if: ${{ env.create_pr == 'true' }} | |
id: cpr | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.PAT_GITHUB_TOKEN }} | |
commit-message: 'chore(${{ matrix.name }}): Automated update to ${{ matrix.current_release }}' | |
signoff: false | |
branch: ${{ env.pr_branch_name }} | |
delete-branch: true | |
title: 'chore(${{ matrix.name }}): Update to ${{ matrix.current_release }}' | |
body: | | |
Automated update for `${{ matrix.name }}` | |
Old version: `${{ matrix.existing_release }}` | |
New version: `${{ matrix.current_release }}` | |
labels: | | |
automated pr | |
draft: false | |
- name: Enable Pull Request Automerge | |
if: ${{ steps.cpr.outputs.pull-request-number }} | |
run: gh pr merge --delete-branch --merge --auto ${{ steps.cpr.outputs.pull-request-number }} | |
env: | |
GH_TOKEN: ${{ secrets.PAT_GITHUB_TOKEN }} |