Skip to content

chore(deps): update peter-evans/create-or-update-comment action to v4… #33

chore(deps): update peter-evans/create-or-update-comment action to v4…

chore(deps): update peter-evans/create-or-update-comment action to v4… #33

name: Lint challenges
on:
push:
branches:
- main
paths:
- "**/challenge.yml"
pull_request:
paths:
- "**/challenge.yml"
workflow_dispatch:
filter:
type: string
description: Glob pattern for target challenges
required: true
default: '**/challenge.yml'
jobs:
get-chals:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
challenges: ${{ github.event_name == 'workflow_dispatch' && inputs.filter || steps.changed-files.outputs.all_changed_and_modified_files }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]
with:
files: "**/challenge.yml"
deploy:
needs: get-chals
runs-on: ubuntu-latest
permissions:
contents: read
steps:
# https://github.com/actions/checkout/issues/165#issuecomment-1639209867
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/[email protected]
with:
python-version: 3.x
- name: Setup ctfcli
run: pip install ctfcli==0.1.0
- name: Load CTFd credentials
run: |
mkdir .ctf
cat <<EOF > .ctf/config
[config]
url = https://${{ vars.CTFD_DOMAIN }}
access_token = ${{ secrets.CTFD_TOKEN }}
[cookies]
site_password = ${{ secrets.CTFD_SITE_PASSWORD }}
[challenges]
EOF
- name: Lint challenges
run: |
shopt -s globstar
for chal in ${{ needs.get-chals.outputs.challenges }}; do
ctf challenge lint $chal --flag_format=${{ vars.FLAG_PREFIX || 'ctf{' }}}
done