-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Move code from didix21/github-actions-orb to this repo
- Change namespace didix21 to qustodio-github
- Loading branch information
Showing
12 changed files
with
117 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: "Test CircleCI Orb" | ||
|
||
on: | ||
repository_dispatch: | ||
types: [build_finished] | ||
|
||
jobs: | ||
build_finished: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: | | ||
echo "Buld number: ${{ github.event.client_payload.build_num }}" | ||
echo "Build url: ${{ github.event.client_payload.build_url }}" | ||
echo "Build commit: ${{ github.event.client_payload.vcs_revision }}" | ||
echo "Build metadata: ${{ github.event.client_payload.metadata }}" | ||
echo "Version provided by metadata: ${{ fromJSON(github.event.client_payload.metadata).version }}" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
version: 2.1 | ||
|
||
description: > | ||
Sample orb description | ||
# What will your orb allow users to accomplish? | ||
# Descriptions should be short, simple, and informative. | ||
Interact with GitHub Actions from CircleCI. In other words, this orbs | ||
triggers a repository_dispatch event within GitHub Actions for the desired repo, | ||
sending a default payload. | ||
# This information will be displayed in the orb registry and is not mandatory. | ||
display: | ||
home_url: "https://www.example.com/docs" | ||
home_url: "https://github.com/qustodio/github-actions-orb" | ||
source_url: "https://github.com/qustodio/github-actions-orb" | ||
|
||
# If your orb requires other orbs, you can import them like this. Otherwise remove the "orbs" stanza. | ||
# orbs: | ||
# hello: circleci/[email protected] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
description: > | ||
Triggers a repository_dispatch event within GitHub Actions for the desired repo. | ||
event_type, repo_name and github_personal_access_token fields must be provided. | ||
parameters: | ||
repo_name: | ||
type: string | ||
description: "The organization and repo name to trigger the event for (ex. `qustodio/hello-world`)" | ||
event_type: | ||
type: string | ||
description: "The ['event_type'](https://docs.github.com/en/free-pro-team@latest/rest/reference/repos#create-a-repository-dispatch-event) parameter to send" | ||
github_personal_access_token: | ||
type: env_var_name | ||
description: "The environment variable name containing a GitHub 'Personal Access Token' (PAT) with the `repo` scope" | ||
metadata: | ||
type: string | ||
description: "Send any payload through this field. For example: `{'version': '0.1.0'}`" | ||
default: "null" | ||
|
||
steps: | ||
- run: | ||
name: "Set enviroment variables" | ||
command: | | ||
echo 'export PRIVATE_GH_TOKEN=$(echo $<< parameters.github_personal_access_token >>)' >> "$BASH_ENV" | ||
source "$BASH_ENV" | ||
- run: | ||
environment: | ||
- REPO_NAME: << parameters.repo_name >> | ||
- EVENT_TYPE: << parameters.event_type >> | ||
- METADATA: << parameters.metadata >> | ||
when: always | ||
name: Bundle build info into webhook payload | ||
command: << include(scripts/send-payload.sh) >> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
description: > | ||
Sample example description. | ||
# Provide a use-case based example for using this orb. | ||
# Everything in the `usage` section will be displayed in the orb registry. | ||
# Comments are not retained. | ||
This is an example on how to use github-actions-orb on CircleCI. | ||
Providing some extra metadata and the event_type. | ||
usage: | ||
version: 2.1 | ||
orbs: | ||
<orb-name>: <namespace>/<orb-name>@1.2.3 | ||
github-actions-orb: qustodio-github/[email protected] | ||
|
||
jobs: | ||
say-hello-to-github: | ||
docker: | ||
- image: cimg/base:stable | ||
steps: | ||
- github-actions/repository_dispatch: | ||
repo_name: "<user>/<your-repo-name>" # Your GitHub organization name + repo name | ||
event_type: "build_finished" # Arbitrary string that your GitHub Actions will filter on | ||
github_personal_access_token: "GITHUB_PERSONAL_TOKEN" | ||
metadata: '{"version": "0.1.0"}' | ||
|
||
# Invoke jobs via workflows | ||
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows | ||
workflows: | ||
use-my-orb: | ||
release: | ||
jobs: | ||
- <orb-name>/<job-name> | ||
- say-hello-to-github |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
OUTPUT=$(echo '{}' | jq '{ | ||
"event_type": env.EVENT_TYPE, | ||
"client_payload": { | ||
"build_num": env.CIRCLE_BUILD_NUM, | ||
"branch": env.CIRCLE_BRANCH, | ||
"username": env.CIRCLE_USERNAME, | ||
"job": env.CIRCLE_JOB, | ||
"build_url": env.CIRCLE_BUILD_URL, | ||
"vcs_revision": env.CIRCLE_SHA1, | ||
"reponame": env.CIRCLE_PROJECT_REPONAME, | ||
"workflow_id": env.CIRCLE_WORKFLOW_ID, | ||
"pull_request": env.CI_PULL_REQUEST, | ||
"metadata": env.METADATA, | ||
} | ||
}' | curl -X POST -H "Content-Type:application/json" -H "Accept:application/vnd.github.v3+json" -H "Authorization: token $PRIVATE_GH_TOKEN" -d @- "https://api.github.com/repos/${REPO_NAME}/dispatches") | ||
|
||
echo "$OUTPUT" | ||
|
||
if [[ -z $OUTPUT ]]; then | ||
exit 0; | ||
else | ||
exit 1; | ||
fi |