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

47 workflow merge main check for pull requests #56

Merged
merged 18 commits into from
Dec 11, 2023
Merged
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
33 changes: 32 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,39 @@ on: #this workflow runs on pull requests and pushes to main or master

#this is a list of all jobs
jobs:
check-pr-sync-with-main:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
- name: Create and checkout a temporary branch from main
run: |
git fetch origin main
git checkout -b temp-branch origin/main
- name: Merge PR branch into temporary branch
run: |
git merge ${{ github.event.pull_request.head.sha }} --no-edit || true
- name: Check for differences
run: |
if git diff --exit-code ${{ github.event.pull_request.head.sha }} temp-branch; then
echo "No differences found. The PR branch is up-to-date with the latest main branch."
else
echo "Differences found. The PR branch is not up-to-date with the latest main branch."
exit 1
fi
linting:
runs-on: ubuntu-latest
needs: check-pr-sync-with-main
steps:
- name: Checkout #checks out our current branch so this runner has the latest code
uses: actions/checkout@v4 #uses means that it is a pre-defined action supplied by GitHub.
Expand All @@ -28,7 +59,7 @@ jobs:

testing: #name of first job
runs-on: ubuntu-latest #sets the env which this job runs on
needs: linting
needs: [linting, check-pr-sync-with-main]
steps: #defines the steps necessary
- name: Checkout #checks out our current branch so this runner has the latest code
uses: actions/checkout@v4 #uses means that it is a pre-defined action supplied by GitHub.
Expand Down