Use repository permissions and branch pushes for CI [skip ci]

This commit is contained in:
Andras Schmelczer 2026-11-11 21:38:29 +00:00
commit c6fb57417f
2 changed files with 8 additions and 21 deletions

View file

@ -2,29 +2,22 @@ name: Docker
on: on:
push: push:
branches: ["main"] branches:
tags: ['v*.*.*'] - "**"
pull_request: tags:
branches: ["main"] - v*.*.*
jobs: jobs:
build: build:
runs-on: ${{ (github.actor == 'renovate-bot' || github.event.pull_request.user.login == 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') || startsWith(github.head_ref, runs-on: docker
'renovate/')) && 'renovate' || 'docker' }}
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: https://code.forgejo.org/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 uses: https://code.forgejo.org/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with: with:
persist-credentials: false persist-credentials: false
- name: Build and publish image - name: Build and publish image
uses: https://git.schmelczer.dev/andras/ci-actions/docker-publish@10ab5db88c5f6fc1d2a368ce0ea934807f7ebfca uses: https://git.schmelczer.dev/andras/ci-actions/docker-publish@10ab5db88c5f6fc1d2a368ce0ea934807f7ebfca
with: with:
context: . context: .
push: ${{ !github.event.pull_request && (!(github.actor == 'renovate-bot' || github.event.pull_request.user.login == 'renovate-bot' || startsWith(github.ref, push: ${{ (github.ref == 'refs/heads/main' || github.ref_type == 'tag') }}
'refs/heads/renovate/') || startsWith(github.head_ref, 'renovate/')) && (github.event_name != 'pull_request')) }} token: ${{ ((github.ref == 'refs/heads/main' || github.ref_type == 'tag')) && secrets.FORGEJO_PACKAGE_TOKEN || '' }}
token: ${{ !github.event.pull_request && (!(github.actor == 'renovate-bot' || github.event.pull_request.user.login == 'renovate-bot' || startsWith(github.ref,
'refs/heads/renovate/') || startsWith(github.head_ref, 'renovate/')) && (github.event_name != 'pull_request')) && secrets.FORGEJO_PACKAGE_TOKEN || ''
}}
if: ${{ contains(fromJSON('["andras","ruby336688","renovate-bot"]'), github.actor) && (!github.event.pull_request || contains(fromJSON('["andras","ruby336688","renovate-bot"]'),
github.event.pull_request.user.login)) }}

View file

@ -2,14 +2,10 @@ name: ShellCheck
on: on:
push: push:
branches: [main]
pull_request:
branches: [main]
jobs: jobs:
shellcheck: shellcheck:
runs-on: ${{ (github.actor == 'renovate-bot' || github.event.pull_request.user.login == 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') || startsWith(github.head_ref, runs-on: docker
'renovate/')) && 'renovate' || 'docker' }}
steps: steps:
- uses: https://code.forgejo.org/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 - uses: https://code.forgejo.org/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
@ -20,5 +16,3 @@ jobs:
- name: Run ShellCheck - name: Run ShellCheck
run: find ./src -name '*.sh' -exec shellcheck {} + run: find ./src -name '*.sh' -exec shellcheck {} +
if: ${{ contains(fromJSON('["andras","ruby336688","renovate-bot"]'), github.actor) && (!github.event.pull_request || contains(fromJSON('["andras","ruby336688","renovate-bot"]'),
github.event.pull_request.user.login)) }}