Skip to content

Commit d5e5b4c

Browse files
committed
Add skeleton.
1 parent ce2702f commit d5e5b4c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+19619
-2678
lines changed

.eslintrc.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2021: true,
5+
},
6+
extends: [
7+
'airbnb-base',
8+
],
9+
parser: '@typescript-eslint/parser',
10+
parserOptions: {
11+
ecmaVersion: 'latest',
12+
sourceType: 'module',
13+
},
14+
plugins: [
15+
'@typescript-eslint',
16+
],
17+
rules: {
18+
'no-console': 0,
19+
'arrow-parens': ['error', 'as-needed'],
20+
},
21+
};

.github/workflows/bot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
on:
2+
issue_comment:
3+
types: [created]
4+
jobs:
5+
test:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
- uses: ./
10+
with:
11+
username: yaml-9000
12+
env:
13+
GITHUB_TOKEN: ${{ secrets.YAML_BOT_TOKEN }}

.github/workflows/tests.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
1-
name: Test
21
on:
3-
push:
4-
branches:
5-
- master
62
pull_request:
3+
74
jobs:
85
test:
96
runs-on: ubuntu-latest
107
steps:
118
- uses: actions/checkout@v2
12-
- name: Get Stars and License
13-
uses: ./
14-
id: sample
9+
- uses: actions/setup-node@master
1510
with:
16-
repo: "italia/publiccode-parser-action"
17-
- name: Check Stars and License
18-
run: |
19-
test -n "${{ steps.sample.outputs.stars }}"
20-
echo "${{ steps.sample.outputs.stars }}"
21-
test -n "${{ steps.sample.outputs.license }}"
22-
echo "${{ steps.sample.outputs.license }}"
11+
node-version: 16.x
12+
- run: npm ci
13+
- run: npm run test

README.md

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,62 @@
1-
# GitHub JavaScript action template
1+
# bot
22

3-
[![Join the #publiccode channel](https://img.shields.io/badge/Slack%20channel-%23publiccode-blue.svg?logo=slack)](https://developersitalia.slack.com/messages/CAM3F785T)
4-
[![Get invited](https://slack.developers.italia.it/badge.svg)](https://slack.developers.italia.it/)
3+
The bot automating the [publiccodeyml organization](https://github.com/publiccodeyml/)
4+
procedures implemented as a GitHub action.
55

6-
This is a template repository for [creating a GitHub JavaScript action](https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action).
6+
## Commands
77

8-
Click `Use this template` button to create your action based on this template.
8+
The bot is instructed to perform tasks using its tag (fe. @yaml-9000) in issues
9+
and PR comments followed by the command.
910

10-
A sample action to get GitHub star counts and license from a given repository.
11+
* `@yaml-9000 vote-start`: Open the pools for the voting procedure on the current
12+
proposal
1113

12-
## Inputs
14+
* `@yaml-9000 vote-end`: End the voting procedure, closing the pools and
15+
announcing the results.
1316

14-
The following inputs briefly explained here are fully declared and documented in the [action.yaml](action.yaml):
17+
* `@yaml-9000 breaking-change`: Mark the proposal as a [breaking change to the Standard](https://github.com/publiccodeyml/publiccode.yml/blob/main/governance/procedure-proposing-changes-and-voting.md#proposing-changes).
1518

16-
* `repo` [**Required**] - GitHub repository to fetch (default `${{ github.repository }}`)
19+
Aliases: `breaking`, `major`
1720

18-
* `github_token` [**Optional**] - GitHub token to interact with GitHub API (default `${{ github.token }}`)
21+
* `@yaml-9000 minor-change`: Mark the proposal as a [minor change to the Standard](https://github.com/publiccodeyml/publiccode.yml/blob/main/governance/procedure-proposing-changes-and-voting.md#proposing-changes)
22+
23+
Aliases: `minor`
24+
25+
* `@yaml-9000 bugfix-change`: Mark the proposal as a [bugfix change to the Standard](https://github.com/publiccodeyml/publiccode.yml/blob/main/governance/procedure-proposing-changes-and-voting.md#proposing-changes)
26+
27+
Aliases: `bugfix`, `patch`
28+
29+
* `@yaml-9000 national-section`: Mark the proposal as a [change in the national section](https://github.com/publiccodeyml/publiccode.yml/blob/main/governance/procedure-proposing-changes-and-voting.md#country-specific-sections) ([doc](https://yml.publiccode.tools/country.html))
30+
31+
Aliases: `national`, `country-section`, `country`, `country-specific`
32+
33+
## Inputs to the GitHub Action
34+
35+
Use the following inputs in the GitHub action via `with`:
36+
37+
* `username` [**Optional**] - GitHub repository to fetch (default `bot`)
38+
* `github_token` [**Optional**] - GitHub token to interact with GitHub API (default `${{ github.token }}`).
39+
40+
If the environment `GITHUB_TOKEN` variable is set, it takes precedence over
41+
the input.
1942

2043
## Examples
2144

22-
Include this action in your repo by creating
23-
`.github/workflows/js-action-template.yml`and edit where needed:
45+
Include this action in your repo by creating
46+
`.github/workflows/publiccodeyml-bot.yml`and edit where needed:
2447

2548
```yml
26-
on: [push, pull_request]
49+
on:
50+
issue_comment:
51+
types: [created]
2752

2853
jobs:
2954
examplejob:
3055
runs-on: ubuntu-latest
31-
name: Get Stars and License
3256
steps:
33-
- uses: actions/checkout@v2
34-
- uses: italia/js-action-template@v1
57+
- uses: publiccodeyml/bot@v1
3558
with:
36-
repo: "italia/publiccode-parser-action"
59+
username: yaml-9000
3760
```
3861
3962
## Build the action
@@ -55,8 +78,6 @@ npm run build
5578
Contributing is always appreciated.
5679
Feel free to open issues, fork or submit a Pull Request.
5780
If you want to know more about how to add new fields, check out [CONTRIBUTING.md](CONTRIBUTING.md).
58-
In order to support other country-specific extensions in addition to Italy some
59-
refactoring might be needed.
6081

6182
## Maintainers
6283

action.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
name: 'Action name'
22
description: 'Action description'
3-
author: 'italia'
43

54
inputs:
65
github_token:
76
description: 'GITHUB_TOKEN'
7+
required: false
88
default: '${{ github.token }}'
9-
repo:
10-
description: 'GitHub repository. e.g. italia/publiccode-parser-action'
11-
default: '${{ github.repository }}'
12-
required: true
13-
14-
outputs:
15-
stars:
16-
description: 'The stars of the repository'
17-
license:
18-
description: 'The license used in the repository'
9+
username:
10+
description: The username of the bot
11+
required: false
12+
default: bot
1913

2014
runs:
21-
using: 'node12'
15+
using: 'node16'
2216
main: 'dist/index.js'
2317

2418
branding:

babel.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
presets: [
3+
['@babel/preset-env', {targets: {node: 'current'}}],
4+
'@babel/preset-typescript',
5+
],
6+
};

dist/breaking-change.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Thanks for your contribution :pray:
2+
3+
This is now marked as a [`breaking-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-breaking-change) proposal to the Standard, this means that an old version of `publiccode.yml` won't be compatible with the new version.
4+
5+
Breaking changes can be released with a new major version at most once every two years, provided the current version of the Standard has been deprecating the object of this proposal for at least 6 months.
6+
7+
Example of breaking changes are removal of keys or changes to key types.
8+
9+
cc {{ chair_tag }} @{{{ steering_committee_team }}}

dist/bugfix-change.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Thanks for your contribution :pray:
2+
3+
This is now marked as a [`bugfix-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-bugfix-change),
4+
this means that this change won't break any compatibility with the old versions of the Standard.
5+
6+
Example of bugfix changes are typo fixes.
7+
8+
cc {{ chair_tag }} @{{{ steering_committee_team }}}

dist/deprecation-change.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Thanks for your contribution :pray:
2+
3+
This is now marked as a [`deprecation-change` proposal to the standard](https://github.com/publiccodeyml/publiccode.yml/labels/standard-deprecation), this means that this change won't break any compatibility with the old versions of the Standard,
4+
and it will be possibile to make the definitive change 6 months after the deprecation with a new major release.
5+
6+
cc {{ chair_tag }} @{{{ steering_committee_team }}}

dist/footer.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- ##bot-comment-marker## -->
2+
<sub>[:page_facing_up: Voting procedure](https://github.com/publiccodeyml/publiccode.yml/blob/main/governance/procedure-proposing-changes-and-voting.md#voting) | [:page_facing_up: Working Group Charter](https://github.com/publiccodeyml/publiccode.yml/blob/main/governance/charter.md) | [:robot: bot commands](https://github.com/publiccodeyml/bot#commands)</sub>

0 commit comments

Comments
 (0)