Make workflows work fine in forked repos (#1845)

This commit is contained in:
Ayaz Salikhov
2022-12-10 00:36:59 +04:00
committed by GitHub
parent 23bf11f66b
commit cdfd63a387
4 changed files with 5 additions and 6 deletions

View File

@@ -56,13 +56,13 @@ jobs:
shell: bash
- name: Login to Docker Hub 🔐
if: github.ref == 'refs/heads/main' || github.event_name == 'schedule'
if: github.repository == 'jupyter/docker-stacks' && (github.ref == 'refs/heads/main' || github.event_name == 'schedule')
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Merge tags for the images 🔀
if: github.ref == 'refs/heads/main' || github.event_name == 'schedule'
if: github.repository == 'jupyter/docker-stacks' && (github.ref == 'refs/heads/main' || github.event_name == 'schedule')
run: python3 -m tagging.merge_tags --short-image-name ${{ inputs.image }} --tags-dir /tmp/tags/
shell: bash

View File

@@ -38,7 +38,7 @@ jobs:
platform: ${{ inputs.platform }}
- name: Login to Docker Hub 🔐
if: github.ref == 'refs/heads/main' || github.event_name == 'schedule'
if: github.repository == 'jupyter/docker-stacks' && (github.ref == 'refs/heads/main' || github.event_name == 'schedule')
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -53,6 +53,6 @@ jobs:
run: python3 -m tagging.apply_tags --short-image-name ${{ inputs.image }} --tags-dir /tmp/tags/ --platform ${{ inputs.platform }} --owner ${{ env.OWNER }}
- name: Push Images to Docker Hub 📤
if: github.ref == 'refs/heads/main' || github.event_name == 'schedule'
if: github.repository == 'jupyter/docker-stacks' && (github.ref == 'refs/heads/main' || github.event_name == 'schedule')
run: docker push --all-tags ${{ env.OWNER }}/${{ inputs.image }}
shell: bash

View File

@@ -39,7 +39,7 @@ jobs:
shell: bash
- name: Push Wiki to GitHub 📤
if: github.ref == 'refs/heads/main' || github.event_name == 'schedule'
if: github.repository == 'jupyter/docker-stacks' && (github.ref == 'refs/heads/main' || github.event_name == 'schedule')
uses: stefanzweifel/git-auto-commit-action@3ea6ae190baf489ba007f7c92608f33ce20ef04a # v4.16.0
with:
commit_message: "Automated wiki publish for ${{ github.sha }}"

View File

@@ -25,7 +25,6 @@ on:
jobs:
build-docs:
name: Build Sphinx Documentation
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'jupyter/docker-stacks')
runs-on: ubuntu-latest
permissions:
contents: write