Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: optimize test runs and add docs syncing dry run #565

Merged
merged 2 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: CI

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this get fired for every push to a pull request or just when one's created?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both! Here's a snippet of the default pull_request behavior from these docs:

By default, a workflow only runs when a pull_request event's activity type is opened, synchronize, or reopened.

As the name implies, the opened activity type is for whenever a PR is opened.

Here's a description of synchronize from these docs:

Triggered when a pull request's head branch is updated. For example, when the head branch is updated from the base branch, when new commits are pushed to the head branch, or when the base branch is changed.


jobs:
build:
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
name: Sync `documentation` directory to ReadMe

# Run workflow for every push to the `main` branch
on:
push:
branches:
- main
# Run workflow for every push
on: push

jobs:
sync:
Expand Down Expand Up @@ -44,7 +41,17 @@ jobs:
# we run the `rdme` GitHub Action to sync the Markdown file
# in the `documentation` directory.
# Here's the page we're syncing: https://docs.readme.com/docs/rdme

# First we're going to perform a dry run of syncing process.
# We do this on every push to ensure that an actual sync will work properly
- name: Sync docs to ReadMe (dry run)
uses: ./
with:
rdme: docs ./documentation --key=${{ secrets.README_DEVELOPERS_API_KEY }} --version=2.0 --dryRun

# And finally, we perform an actual sync to ReadMe if we're on the main branch
- name: Sync docs to ReadMe
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main'
# We use the `main` branch as ref for GitHub Action
# This is NOT recommended, as it can break your workflows without notice!
# We recommend specifying a fixed version, i.e. @7.0
Expand Down