Skip to content

Commit

Permalink
global: remove pooling
Browse files Browse the repository at this point in the history
  • Loading branch information
mojib committed Apr 7, 2024
1 parent b0af437 commit d360053
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,33 @@ to finish, so you would get a notification if the deployment failed.

## Inputs

### `host`
### `URL`

The GitLab URL to trigger the pipeline on. Default `gitlab.com`.

### `project_id`
### `PROJECT_ID`

**Required** The ID or path of the project owned by the authenticated user.
You will find the *Project ID* in the *General Settings* of your GitLab project.

### `ref_name`
### `REF_NAME`

**Required** The branch or tag to run the pipeline on.

### `gitlab_trigger_token`
### `GITLB_TRIGGER_TOKEN`

**Required** The [GitLab pipeline trigger token](https://docs.gitlab.com/ee/ci/triggers/index.html#create-a-trigger-token)
to trigger the pipeline.

### `access_token`
### `ACCESS_TOKEN`

The [GitLab pipeline access token](https://docs.gitlab.com/ee/user/project/settings/project_access_tokens.html)
to access the pipeline via the API. You need the `read_api` and `read_repository` scopes with `Guest` role for this token.

For public projects you don't need to provide an access token.


### `pipeline_variables`
### `PIPELINE_VARIABLES`

A map of key-valued strings containing the pipeline variables. For example: `{ VAR1: "value1", VAR2: "value2" }`.. Default `"World"`.

Expand All @@ -61,9 +61,9 @@ The URL of the pipeline, for example `https://gitlab.com/foo/bar/pipelines/47`.
```yaml
uses: mb-wali/[email protected]
with:
host: 'gitlab.example.com'
gitlab_trigger_token: ${{ secrets.DEPLOY_TRIGGER_TOKEN }}
project_id: '123'
ref_name: 'main'
pipeline_variables: '{"VAR1":"value1","VAR2":"value2"}'
URL: 'gitlab.example.com'
GITLB_TRIGGER_TOKEN: ${{ secrets.DEPLOY_TRIGGER_TOKEN }}
PROJECT_ID: '123'
REF_NAME: 'main'
PIPELINE_VARIABLES: '{"VAR1":"value1","VAR2":"value2"}'
```
14 changes: 7 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ branding:
icon: 'git-commit'
color: 'orange'
inputs:
project_id:
PROJECT_ID:
description: 'The ID or URL-encoded path of the project owned by the authenticated user.'
required: true
default: ''
gitlab_trigger_token:
GITLB_TRIGGER_TOKEN:
description: 'The GitLab Trigger Token'
required: true
default: ''
ref_name:
REF_NAME:
description: 'The GitLab branch or tag name'
required: false
default: 'main'
host:
URL:
description: 'The GitLab URL'
required: false
default: 'gitlab.com'
pipeline_variables:
PIPELINE_VARIABLES:
description: 'A map of key-valued strings containing the pipeline variables. For example: { VAR1: "value1", VAR2: "value2" }.'
required: false
access_token:
ACCESS_TOKEN:
description: 'Pipeline Access Token, see https://docs.gitlab.com/ee/user/project/settings/project_access_tokens.html'
required: false
default: ''
Expand All @@ -35,4 +35,4 @@ outputs:
description: 'The URL of the pipeline.'
runs:
using: 'node20'
main: 'dist/index.js'
main: 'dist/index.js'
14 changes: 7 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26877,12 +26877,12 @@ const pollPipeline = async (host, projectId, token, pipelineId, webUrl) => {
}

async function run() {
const host = encodeURIComponent(core.getInput('host'));
const projectId = encodeURIComponent(core.getInput('project_id'));
const triggerToken = core.getInput('gitlab_trigger_token');
const accessToken = core.getInput('access_token');
const ref = core.getInput('ref_name');
const input = core.getInput('pipeline_variables');
const host = encodeURIComponent(core.getInput('URL'));
const projectId = encodeURIComponent(core.getInput('PROJECT_ID'));
const triggerToken = core.getInput('GITLB_TRIGGER_TOKEN');
const accessToken = core.getInput('ACCESS_TOKEN');
const ref = core.getInput('REF_NAME');
const input = core.getInput('PIPELINE_VARIABLES');
const variables = input ? JSON.parse(input) : null;

console.log(`Triggering pipeline ${projectId} with ref ${ref} on ${host}!`);
Expand Down Expand Up @@ -26919,7 +26919,7 @@ async function run() {
console.log(`Pipeline id ${data.id} triggered! See ${data.web_url} for details.`);

// // poll pipeline status
await pollPipeline(host, projectId, accessToken, data.id, data.web_url);
// await pollPipeline(host, projectId, accessToken, data.id, data.web_url);
} catch (error) {
core.setFailed(error.message);
}
Expand Down
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ const pollPipeline = async (host, projectId, token, pipelineId, webUrl) => {
}

async function run() {
const host = encodeURIComponent(core.getInput('host'));
const projectId = encodeURIComponent(core.getInput('project_id'));
const triggerToken = core.getInput('gitlab_trigger_token');
const accessToken = core.getInput('access_token');
const ref = core.getInput('ref_name');
const input = core.getInput('pipeline_variables');
const host = encodeURIComponent(core.getInput('URL'));
const projectId = encodeURIComponent(core.getInput('PROJECT_ID'));
const triggerToken = core.getInput('GITLB_TRIGGER_TOKEN');
const accessToken = core.getInput('ACCESS_TOKEN');
const ref = core.getInput('REF_NAME');
const input = core.getInput('PIPELINE_VARIABLES');
const variables = input ? JSON.parse(input) : null;

console.log(`Triggering pipeline ${projectId} with ref ${ref} on ${host}!`);
Expand Down Expand Up @@ -111,7 +111,7 @@ async function run() {
console.log(`Pipeline id ${data.id} triggered! See ${data.web_url} for details.`);

// // poll pipeline status
await pollPipeline(host, projectId, accessToken, data.id, data.web_url);
// await pollPipeline(host, projectId, accessToken, data.id, data.web_url);
} catch (error) {
core.setFailed(error.message);
}
Expand Down

0 comments on commit d360053

Please sign in to comment.