Schedule #19
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: Schedule | |
on: | |
# allow to manual run the action | |
workflow_dispatch: {} | |
schedule: | |
# Run early in the morning every work day | |
- cron: '30 3 * * 1-5' | |
jobs: | |
check: | |
name: 'Check for changes' | |
runs-on: 'ubuntu-latest' | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Use Node.js' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
- name: npm build and test | |
run: | | |
npm run clean | |
npm run build | |
node dist/cli.js update xbau | |
node dist/cli.js update xbau-kernmodul | |
- uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: | | |
src: | |
- '**' | |
- name: Check for open PR with label | |
id: check | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const prs = await github.rest.pulls.list({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
state: "open", | |
}); | |
const found = prs.data.find(pr => | |
pr.labels.find(label => label.name === "your-label-name") | |
); | |
core.setOutput("exists", Boolean(found)); | |
# push the change if exists and not already a PR with label exists | |
- name: Create Pull Request | |
id: pull-request | |
if: steps.changes.outputs.src == 'true' && steps.check.outputs.exists != 'true' | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
commit-message: 'chore: Update in Xbau Standard' | |
labels: content-update | |
title: 'Update in Xbau Standards' |