Skip to content

Commit

Permalink
fix(workflows): rollback deploy changes and make contribs run only on…
Browse files Browse the repository at this point in the history
… master
  • Loading branch information
FonduemangVI committed Jun 2, 2024
1 parent 94cd603 commit 0e40de2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Build and Deploy Docs

on:
workflow_run:
workflows: [Update contributors]
types:
- completed
push:
branches:
- master
pull_request:

jobs:
build:
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
run: mkdocs build

deploy:
if: github.event.workflow_run.event == 'push' && contains(fromJson('["master", "main"]'), github.event.workflow_run.head_branch)
if: github.event_name == 'push' && contains(fromJson('["refs/heads/master", "refs/heads/main"]'), github.ref)
needs: build
name: Deploy docs
runs-on: ubuntu-latest
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/update_contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,17 @@ on:
push:
branches:
- master
pull_request:

permissions:
contents: write

jobs:
update_contributors:
if: github.event_name == 'push' && contains(fromJson('["refs/heads/master", "refs/heads/main"]'), github.ref)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} # Use the forked repository if available, otherwise the main repository
ref: ${{ github.event.pull_request.head.ref || github.ref_name }} # Use the PR branch name if available, otherwise the branch name
fetch-depth: 0 # Fetch all history for all branches and tags

- name: Install Node.js
uses: actions/setup-node@v4
Expand All @@ -34,9 +30,8 @@ jobs:
- name: Commit and push if it's not up to date
run: |
git diff
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git checkout -B ${{ github.event.pull_request.head.ref || github.ref_name }} # Ensure we're on the correct branch
git diff
git commit -am "chore(contributors): Update CONTRIBUTORS.md" || exit 0
git push origin ${{ github.event.pull_request.head.ref || github.ref_name }}
git push

0 comments on commit 0e40de2

Please sign in to comment.