Skip to content

rename expo floor switches/aps #458

rename expo floor switches/aps

rename expo floor switches/aps #458

Workflow file for this run

---
name: PR comments to trigger gitlab-ci jobs
on:
pull_request_review_comment:
types:
- created
issue_comment:
types:
- created
jobs:
verify:
name: Verify Commenter
runs-on: ubuntu-22.04
steps:
- name: Standardize PR comment
id: pr-standardize-comment
uses: nebulaworks/[email protected]
- name: 'Collect event data'
# Currently limiting this to robs user til stable
if: >
startsWith(steps.pr-standardize-comment.outputs.comment, '/tux')
&& github.actor == 'sarcasticadmin'
id: job
run: |
set -eux
SUBCOMM=$(cut -d ' ' -f 2 <<< "${{ steps.pr-standardize-comment.outputs.comment }}")
SUBARGS="$(cut -d ' ' -f 3- <<< "${{ steps.pr-standardize-comment.outputs.comment }}")"
# Have to do this to get git commit ref for comments in PRs
# "github.event.pull_request.head" will not work since this
# is not a PR event
REF=$(curl -sSf \
--url ${{ steps.pr-standardize-comment.outputs.url }} \
--header 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'Content-Type: application/json' | jq -r '.head.ref' \
)
echo ::set-output name=subcomm::$SUBCOMM
echo ::set-output name=subargs::$SUBARGS
echo ::set-output name=ref::$REF
continue-on-error: true
outputs:
subcomm: ${{ steps.job.outputs.subcomm }}
subargs: ${{ steps.job.outputs.subargs }}
ref: ${{ steps.job.outputs.ref }}
issue_number: ${{ steps.pr-standardize-comment.outputs.issue_number }}
flash:
name: Flash netgear hardware
runs-on: ubuntu-22.04
needs: verify
if: >
needs.verify.outputs.subcomm == 'openwrt'
&& startsWith(needs.verify.outputs.subargs, 'flash')
steps:
# secret required is a gitlab trigger token
# ref: https://docs.gitlab.com/ee/ci/triggers/#create-a-trigger-token
- name: 'call gitlab pipeline'
id: flash
run: |
set -euo pipefail
WORMHOLE_CODE=$(cut -d ' ' -f 2 <<< "${{ needs.verify.outputs.subargs }}")
PIPELINE=$(curl -f --request POST \
--form token=${{ secrets.GITLAB_TOKEN }} \
--form "ref=${{ needs.verify.outputs.ref }}" \
--form "variables[OPENWRT_INTEG]=YES" \
--form variables[WORMHOLE_CODE]=$WORMHOLE_CODE \
https://gitlab.com/api/v4/projects/17362342/trigger/pipeline | jq -r .web_url)
echo ::set-output name=pipeline::$PIPELINE
- name: Create status PR Comment
if: ${{ success() }}
uses: peter-evans/create-or-update-comment@ca08ebd5dc95aa0cd97021e9708fcd6b87138c9b # SHA ref: v3.0.1
with:
issue-number: ${{ needs.verify.outputs.issue_number }}
body: |
[RUNNING] - Successfully triggered gitlab flash pipeline:
- gitlab pipeline: ${{ steps.flash.outputs.pipeline }}
- name: Create status PR comment failure
if: ${{ failure() }}
uses: peter-evans/create-or-update-comment@ca08ebd5dc95aa0cd97021e9708fcd6b87138c9b # SHA ref: v3.0.1
with:
issue-number: ${{ needs.verify.outputs.issue_number }}
body: |
[FAIL] - Error triggering gitlab flash pipeline
outputs:
pipeline: ${{ steps.flash.outputs.pipeline }}