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

Add pull request support #60

Merged
merged 1 commit into from
May 13, 2024
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
22 changes: 22 additions & 0 deletions .github/workflows/close_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: ClosePullRequestAction

on:
pull_request_target:
types: [closed]
branches: [ main ]

jobs:
close:
runs-on: self-hosted
steps:
- name: close pull request
run: |
PR_NUMBER=$(jq -r ".pull_request.number" $GITHUB_EVENT_PATH)
echo "Cleaning up after $PR_NUMBER has closed"
BUILDDIR="/srv/websitepreview/$AWS_STATIC_SITE_URL-$PR_NUMBER"
if [ -d "$BUILDDIR" ]; then
echo "Removing website review directory"
rm -rf "$BUILDDIR"
else
echo "No website review directory ($BUILDDIR) to remove"
fi
32 changes: 32 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: PullRequestAction

on:
pull_request_target:
branches: [ main ]

# Cancel in-progress jobs or runs for the current pull request
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true

jobs:
process-pull-request:
runs-on: self-hosted
steps:
- name: Fetch git repository
uses: actions/[email protected]
with:
fetch-depth: "0"

- name: Initialise status
run: /srv/github-action-scripts/init-deploy-preview.sh
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Merge test branch
uses: linaro-its/[email protected]

- name: Build site
run: /srv/github-action-scripts/build-astro-site.sh
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}