Skip to content

Commit 63a7f68

Browse files
authored
Merge pull request #4 from eic/add-gitlab-mirroring
Add action to trigger gitlab pipelines
2 parents ec0f089 + a3ace90 commit 63a7f68

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

.github/workflows/mirror.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Mirror and Trigger EICweb
2+
3+
on:
4+
delete:
5+
push:
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: mirror-${{ github.event_name }}
10+
cancel-in-progress: false
11+
12+
jobs:
13+
build:
14+
name: Mirror and Trigger EICweb
15+
runs-on: ubuntu-latest
16+
permissions:
17+
actions: write
18+
contents: read
19+
statuses: write
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
- name: Push to EICweb
26+
uses: eic/gitlab-sync@v1
27+
with:
28+
url: https://eicweb.phy.anl.gov/EIC/campaigns/datasets.git
29+
token: ${{ secrets.GITLAB_TOKEN }}
30+
username: ${{ secrets.GITLAB_USERNAME }}
31+
ciskip: true
32+
- name: Trigger EICweb
33+
id: trigger_eicweb
34+
uses: eic/trigger-gitlab-ci@v3
35+
if: ${{ github.event_name != 'delete' }}
36+
with:
37+
url: https://eicweb.phy.anl.gov
38+
project_id: 491
39+
token: ${{ secrets.EICWEB_CAMPAIGNS_DATASETS_TRIGGER }}
40+
ref_name: ${{ github.event.pull_request.head.ref || github.ref }}
41+
variables: |
42+
GITHUB_REPOSITORY=${{ github.repository }}
43+
GITHUB_SHA=${{ github.event.pull_request.head.sha || github.sha }}
44+
GITHUB_PR=${{ github.event.pull_request.number }}
45+
PIPELINE_NAME=${{ github.repository }}: ${{ github.event.pull_request.title || github.ref_name }}
46+
- name: Set pending EICweb status
47+
if: ${{ github.event_name != 'delete' }}
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
DETECTOR_CONFIG: epic_craterlake
51+
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
52+
REPO: ${{ github.repository }}
53+
PIPELINE_URL: ${{ fromJson(steps.trigger_eicweb.outputs.json).web_url }}
54+
run: |
55+
curl --fail-with-body \
56+
-X POST \
57+
-H "Accept: application/vnd.github+json" \
58+
-H "Authorization: Bearer $GITHUB_TOKEN" \
59+
-H "X-GitHub-Api-Version: 2022-11-28" \
60+
-d "{\"context\": \"eicweb/campaigns/datasets (nightly, $DETECTOR_CONFIG)\", \"state\": \"pending\", \"description\": \"Waiting for response from the EICweb\", \"target_url\": \"$PIPELINE_URL\"}" \
61+
"https://api.github.com/repos/$REPO/statuses/$COMMIT_SHA"

0 commit comments

Comments
 (0)