Skip to content

Commit 0ce49e5

Browse files
authored
Merge pull request #644 from Licini/doc-workflow-fix
Doc workflow fix
2 parents b8d9ac9 + a2025f2 commit 0ce49e5

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

.github/workflows/cleanup.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,31 @@ jobs:
1111
build:
1212
name: cleanup
1313
runs-on: ubuntu-latest
14+
env:
15+
PULL_FOLDER: pull_${{ github.event.pull_request.number }}
1416
steps:
1517
# checkout at gh-pages branch
1618
- uses: actions/checkout@v2
1719
with:
1820
ref: gh-pages
1921

22+
# check if folder for this pull request exists
23+
- name: Check folder existence
24+
id: check_files
25+
uses: andstor/file-existence-action@v1
26+
with:
27+
files: ${{ env.PULL_FOLDER }}
28+
2029
# delete the corresponding pull request doc folder
2130
- name: Delete folder
22-
env:
23-
PULL_FOLDER: pull_${{ github.event.pull_request.number }}
31+
if: steps.check_files.outputs.files_exists == 'true'
2432
run: |
2533
echo the folder $PULL_FOLDER will be deleted
2634
if [ -d "$PULL_FOLDER" ]; then rm -Rf $PULL_FOLDER; fi
2735
2836
# force push the deletion to gp-pages
2937
- name: Deploy docs
30-
if: success()
38+
if: success() && steps.check_files.outputs.files_exists == 'true'
3139
uses: crazy-max/ghaction-github-pages@v2
3240
with:
3341
target_branch: gh-pages

.github/workflows/docs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212
build:
1313
name: build and deploy docs
1414
runs-on: ubuntu-latest
15+
env:
16+
GH_PAT: ${{secrets.GH_PAT}}
1517
steps:
1618
- uses: actions/checkout@v2
1719
- name: Set up Python 3.8
@@ -44,7 +46,7 @@ jobs:
4446
echo "Docs will be deployed to https://compas.dev/compas/$BRANCH_OR_TAG"
4547
mkdir -p deploy/$BRANCH_OR_TAG && mv -T dist/docs deploy/$BRANCH_OR_TAG/
4648
- name: Deploy docs
47-
if: success()
49+
if: success() && env.GH_PAT != ''
4850
uses: crazy-max/ghaction-github-pages@v2
4951
with:
5052
target_branch: gh-pages

0 commit comments

Comments
 (0)