Skip to content

Commit bb1630c

Browse files
Document permissions required for a private repository (#33)
1 parent b04e0bc commit bb1630c

File tree

4 files changed

+55
-16
lines changed

4 files changed

+55
-16
lines changed

.github/workflows/dash0.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_run:
55
workflows:
66
# The name of the workflow(s) that triggers the export
7-
- "Build"
7+
- "My workflow"
88
types: [completed]
99

1010
jobs:

.github/workflows/honeycomb.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_run:
55
workflows:
66
# The name of the workflow(s) that triggers the export
7-
- "Build"
7+
- "My workflow"
88
types: [completed]
99

1010
jobs:

.github/workflows/private.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Export workflow from a private repository
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
# The name of the workflow(s) that triggers the export
7+
- "My workflow"
8+
types: [completed]
9+
10+
jobs:
11+
otel-export-axiom:
12+
runs-on: ubuntu-latest
13+
# Permissions can be set on a per-job basis or at the top level
14+
permissions:
15+
contents: read # To access the private repository
16+
actions: read # To read workflow runs
17+
pull-requests: read # To read PR labels
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Export workflow
21+
uses: corentinmusard/otel-cicd-action@v1
22+
with:
23+
otlpEndpoint: "CHANGE_ME"
24+
otlpHeaders: "CHANGE_ME"
25+
githubToken: ${{ secrets.GITHUB_TOKEN }}
26+
runId: ${{ github.event.workflow_run.id }}

README.md

+27-14
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ This is a fork of [otel-export-trace-action](https://github.com/inception-health
1313

1414
We provide sample code for popular platforms. If you feel one is missing, please open an issue.
1515

16-
| Code Sample | File |
17-
| --------------------------- | ------------------------------------------------------------------------------------------------------------- |
18-
| Inside an existing workflow | [build.yml](https://github.com/corentinmusard/otel-cicd-action/tree/main/.github/workflows/build.yml) |
19-
| Axiom | [axiom.yml](https://github.com/corentinmusard/otel-cicd-action/tree/main/.github/workflows/axiom.yml) |
20-
| New Relic | [newrelic.yml](https://github.com/corentinmusard/otel-cicd-action/tree/main/.github/workflows/newrelic.yml) |
21-
| Honeycomb | [honeycomb.yml](https://github.com/corentinmusard/otel-cicd-action/tree/main/.github/workflows/honeycomb.yml) |
22-
| Dash0 | [dash0.yml](https://github.com/corentinmusard/otel-cicd-action/tree/main/.github/workflows/dash0.yml) |
23-
| Jaeger | WIP |
24-
| Grafana | WIP |
16+
| Code Sample | File |
17+
| --------------------------- | ------------------------------------------------ |
18+
| Inside an existing workflow | [build.yml](.github/workflows/build.yml) |
19+
| From a private repository | [private.yml](.github/workflows/private.yml) |
20+
| Axiom | [axiom.yml](.github/workflows/axiom.yml) |
21+
| New Relic | [newrelic.yml](.github/workflows/newrelic.yml) |
22+
| Honeycomb | [honeycomb.yml](.github/workflows/honeycomb.yml) |
23+
| Dash0 | [dash0.yml](.github/workflows/dash0.yml) |
24+
| Jaeger | WIP |
25+
| Grafana | WIP |
2526

2627
### On workflow_run event
2728

@@ -65,21 +66,33 @@ jobs:
6566
githubToken: ${{ secrets.GITHUB_TOKEN }}
6667
```
6768
69+
### Private Repository
70+
71+
If you are using a private repository, you need to set the following permissions in your workflow file.
72+
It can be done at the global level or at the job level.
73+
74+
```yaml
75+
permissions:
76+
contents: read # To access the private repository
77+
actions: read # To read workflow runs
78+
pull-requests: read # To read PR labels
79+
```
80+
6881
### Action Inputs
6982
7083
| name | description | required | default | example |
7184
| --------------- | ----------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------- | ---------------------------------------------------------------- |
72-
| otlpEndpoint | The destination endpoint to export OpenTelemetry traces to. It supports `https://` and `grpc://` endpoints. | true | | `https://api.axiom.co/v1/traces` |
85+
| otlpEndpoint | The destination endpoint to export OpenTelemetry traces to. It supports `https://`, `http://` and `grpc://` endpoints. | true | | `https://api.axiom.co/v1/traces` |
7386
| otlpHeaders | Headers to add to the OpenTelemetry exporter . | true | | `x-honeycomb-team=YOUR_API_KEY,x-honeycomb-dataset=YOUR_DATASET` |
7487
| otelServiceName | OpenTelemetry service name | false | `<The name of the exported workflow>` | `Build CI` |
7588
| githubToken | The repository token with Workflow permissions. Required for private repos | false | | `${{ secrets.GITHUB_TOKEN }}` |
7689
| runId | Workflow Run ID to Export | false | env.GITHUB_RUN_ID | `${{ github.event.workflow_run.id }}` |
7790

7891
### Action Outputs
7992

80-
| name | description |
81-
| ------- | ----------------------------------------- |
82-
| traceId | The OpenTelemetry Trace ID for this Trace |
93+
| name | description |
94+
| ------- | ------------------------------------------- |
95+
| traceId | The OpenTelemetry Trace ID of the root span |
8396

8497
[Sample OpenTelemetry Output](./src/__assets__/output.txt).
8598

@@ -207,7 +220,7 @@ jobs:
207220
| github.job.runner_group_id | integer | Github Job Runner Group ID |
208221
| github.job.runner_group_name | string | Github Job Runner Group Name |
209222
| github.job.runner_name | string | Github Job Runner Name |
210-
| github.job.step.id | string | GitHub Step ID |
223+
| github.job.step.status | string | GitHub Step Run Status |
211224
| github.job.step.conclusion | string | Github Step Run Conclusion |
212225
| github.job.step.name | string | Github Step Run Name |
213226
| github.job.step.number | integer | Github Step Run Number |

0 commit comments

Comments
 (0)