Skip to content

Commit

Permalink
Add pull request support
Browse files Browse the repository at this point in the history
  • Loading branch information
philip-linaro committed May 13, 2024
1 parent 8d5643a commit 4188cc8
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
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 }}

0 comments on commit 4188cc8

Please sign in to comment.