mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-10 04:43:03 -05:00
feat: test github actio
This commit is contained in:
13
.github/workflows/add-label/action.yml
vendored
Normal file
13
.github/workflows/add-label/action.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
name: 'Hello World'
|
||||
description: 'Greet someone and record the time'
|
||||
inputs:
|
||||
who-to-greet: # id of input
|
||||
description: 'Who to greet'
|
||||
required: true
|
||||
default: 'World'
|
||||
outputs:
|
||||
time: # id of output
|
||||
description: 'The time we greeted you'
|
||||
runs:
|
||||
using: 'node20'
|
||||
main: 'index.js'
|
||||
15
.github/workflows/add-label/index.js
vendored
Normal file
15
.github/workflows/add-label/index.js
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
const core = require('@actions/core');
|
||||
const github = require('@actions/github');
|
||||
|
||||
try {
|
||||
// `who-to-greet` input defined in action metadata file
|
||||
const nameToGreet = core.getInput('who-to-greet');
|
||||
console.log(`Hello ${nameToGreet}!`);
|
||||
const time = (new Date()).toTimeString();
|
||||
core.setOutput("time", time);
|
||||
// Get the JSON webhook payload for the event that triggered the workflow
|
||||
const payload = JSON.stringify(github.context.payload, undefined, 2)
|
||||
console.log(`The event payload: ${payload}`);
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
16
.github/workflows/label-issue.yml
vendored
16
.github/workflows/label-issue.yml
vendored
@@ -2,7 +2,7 @@ name: Add Labels
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [ opened ]
|
||||
types: [ opened, edited, synchronize ]
|
||||
|
||||
jobs:
|
||||
add_supporters:
|
||||
@@ -15,6 +15,7 @@ jobs:
|
||||
uses: actions-ecosystem/action-add-labels@v1
|
||||
if: ${{ contains( fromJson('[ "tomalaforge", "alcaidio" , "svenson95", "jdegand", "DeveshChau", "stillst", "wandri", "webbomj", "kabrunko-dev", "Sanjar1304"]'), github.actor ) && startsWith(github.event.pull_request.title, 'Answer') }}
|
||||
with:
|
||||
github_token: ${{ secrets.github_token }}
|
||||
labels: supporter
|
||||
add_answers:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -26,4 +27,17 @@ jobs:
|
||||
uses: actions-ecosystem/action-add-labels@v1
|
||||
if: ${{ startsWith(github.event.pull_request.title, 'Answer') }}
|
||||
with:
|
||||
github_token: ${{ secrets.github_token }}
|
||||
labels: answer
|
||||
hello_world_job:
|
||||
runs-on: ubuntu-latest
|
||||
name: A job to say hello
|
||||
steps:
|
||||
- name: Hello world action step
|
||||
id: hello
|
||||
uses: ./add-label/
|
||||
with:
|
||||
who-to-greet: 'Mona the Octocat'
|
||||
# Use the output from the `hello` step
|
||||
- name: Get the output time
|
||||
run: echo "The time was ${{ steps.hello.outputs.time }}"
|
||||
|
||||
Reference in New Issue
Block a user