Skip to content

Commit 91f61f8

Browse files
authored
Add action to trigger gitlab pipelines
1 parent ec0f089 commit 91f61f8

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/mirror.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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@master
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+
run: |
52+
curl \
53+
--fail-with-body \
54+
-X POST \
55+
-H "Accept: application/vnd.github+json" \
56+
-H "Authorization: Bearer $GITHUB_TOKEN" \
57+
-H "X-GitHub-Api-Version: 2022-11-28" \
58+
-d '{"context": "eicweb/campaigns/datasets (nightly, '"$DETECTOR_CONFIG"')", "state": "pending", "description": "Waiting for response from the EICweb", "target_url": "${{ fromJson(steps.trigger_eicweb.outputs.json).web_url }}"}' \
59+
"https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha || github.sha }}"

0 commit comments

Comments
 (0)