Skip to content

02 Maintain: Update Workflow Files #63

02 Maintain: Update Workflow Files

02 Maintain: Update Workflow Files #63

name: "02 Maintain: Update Workflow Files"
on:
workflow_dispatch:
inputs:
name:
description: 'Who triggered this build (enter github username to tag yourself)?'
required: true
default: 'weekly run'
clean:
description: 'Workflow files/file extensions to clean (no wildcards, enter "" for none)'
required: false
default: '.yaml'
schedule:
# Run every Tuesday
- cron: '0 0 * * 2'
jobs:
check_token:
name: "Check SANDPAPER_WORKFLOW token"
runs-on: ubuntu-22.04
outputs:
workflow: ${{ steps.validate.outputs.wf }}
repo: ${{ steps.validate.outputs.repo }}
steps:
- name: "validate token"
id: validate
uses: carpentries/actions/check-valid-credentials@main
with:
token: ${{ secrets.SANDPAPER_WORKFLOW }}
update_workflow:
name: "Update Workflow"
runs-on: ubuntu-22.04
needs: check_token
if: ${{ needs.check_token.outputs.workflow == 'true' }}
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: Update Workflows
id: update
uses: carpentries/actions/update-workflows@main
with:
clean: ${{ github.event.inputs.clean }}
- name: Create Pull Request
id: cpr
if: "${{ steps.update.outputs.new }}"
uses: carpentries/create-pull-request@main
with:
token: ${{ secrets.SANDPAPER_WORKFLOW }}
delete-branch: true
branch: "update/workflows"
commit-message: "[actions] update sandpaper workflow to version ${{ steps.update.outputs.new }}"
title: "Update Workflows to Version ${{ steps.update.outputs.new }}"
body: |
:robot: This is an automated build
Update Workflows from sandpaper version ${{ steps.update.outputs.old }} -> ${{ steps.update.outputs.new }}
- Auto-generated by [create-pull-request][1] on ${{ steps.update.outputs.date }}
[1]: https://github.com/carpentries/create-pull-request/tree/main
labels: "type: template and tools"
draft: false